1

Problem

I have conflicting perceptions of when a schedule violates 2PL or not.

My first perception is that 2PL only applies to the level of a transaction at a time, since this is what I learned in a Database course: enter image description here

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) 

where:

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.

Question

Does the 2PL rule apply to the schedule as a whole, or to each transaction individualy?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.