Transaction Analysis, Evaluation, and Comparison
A transaction follows the two-phase locking (2PL) protocol if all locking operations (read_lock, write_lock) precede the first unlock operation in the transaction.
Such a transaction can be divided into two phases: an expanding or growing (first) phase, during which new locks on items can be acquired but none can be released, and a shrinking (second) phase, during which existing locks can be released but no new locks can be acquired (Elmasri, 2017).
To prepare:
• Review the media piece, Definition of Transaction Management, found in this week’s Learning Resources. (https://mym.cdn.laureate-media.com/2dett4d/Walden/ITEC/ITEC8240/03/01DTM/story_html5.html)
To complete this Assignment:
- Consider the transactions:
T1: R1(A), W1(B)
and
T2: R2(A), W2(A), W2(B)
Suppose we insert a pair of lock and unlock commands for each element of the database that the transactions can access.
• Explain how many concurrent execution schedules, of the two transactions, follow the 2PL protocol.
• Explain whether there are any serializable schedules of concurrent execution of the two transactions that do not follow the 2PL protocol. - Consider the following transactions:
T1: R1(A), R1(B), INC1(A), INC1(B)
and
T2: R2(A), R2(B), INC2(A), INC2(B)
• Explain how many serializable schedules of concurrent execution of the two transactions there are.
• If the order of the increment operations in T2 is reversed, how many serializable schedules of concurrent execution of the two transactions are there?
Sample Solution