The rules for 2PL are similar to those of Strict 2PL:
So, every transaction has a growing phase (it acquires locks) and a shrinking phase (it releases locks). 2PL allows only conflict serializable schedules.
2PL in action:
& X(A) \\ & R(A) \\ & X(B)\\ & R(B) \\ & W(B)\\X(B) & \\ R(B) & \\ W(B) & \\ Com. &\\
& Com. \end{bmatrix}</math>
Notice that in this schedule, A and B can be accessed by both T1 and T2 even before commit time.
The deadlocked schedule in Strict 2PL:
& X(B) & \\X(B) & \\
& X(A) \end{bmatrix}</math>
Text: T1: X(A) T2:X(B) T1:X(B) T2: X(A)
does not need to be deadlocked in 2PL, since T1 and T2 can release its locks on its objects before the other transaction requests locks on the objects.
wikipedia.org dumped 2003-03-17 with terodump