I have conflicting perceptions of when a schedule violates 2PL or not.
I understand the above as meaning that locks and unlocks between the same transaction as being allowed to interleave, so long as all locks within one transaction precede all unlocks of the same transaction. For the example schedule below:
l1(A), l1(B), w1(A), w1(B), u1(A), l2(A), u1(B), r2(A), u2(A)
li(X) means transaction i locks object x
wi(X) means transaction i writes to object x
ri(X) means transaction i reads from object x
ui(X) means transaction i unlocks object x
this schedule would be 2PL because all unlocks of each transaction happen after all locks within the same transaction.
However, I got penalized on a homework for this train of thought on a similar schedule (which is different from the one above) because the locks of the entire schedule as a whole did not occur before all the unlocks of the schedule as a whole.
Does the 2PL rule apply to the schedule as a whole, or to each transaction individualy?