Now, I have two transactions here. The consistency requirement be A=0 v B=0, with A=B=0 the initial values
T1: read(A);
read(B);
if A=0 then B:=B+1;
write(B).
T2: read(B);
read(A);
if B=0 then A:=A+1;
write(A).
I know that there is no parallel execution resulting in a serializable schedule. So I want to apply two-phase locking to guarantee serializability.
How dose two-phase locking guarantee serializability? Can you give me one example of these two transactions?
Thank you.