Which of the following statements about the Two Phase Locking (2PL) protocol…
2024
Which of the following statements about the Two Phase Locking (2PL) protocol is/are TRUE?
- A.
2PL permits only serializable schedules
- B.
With 2PL, a transaction always locks the data item being read or written just before every operation and always releases the lock just after the operation
- C.
With 2PL, once a lock is released on any data item inside a transaction, no more locks on any data item can be obtained inside that transaction
- D.
A deadlock is possible with 2PL
Attempted by 103 students.
Show answer & explanation
Correct answer: A, C, D
Answer: The true statements are the ones that assert the protocol guarantees serializable schedules, that once a lock is released no new locks can be obtained thereafter, and that deadlocks are possible.
Explanation:
Two-Phase Locking guarantees conflict-serializability by dividing each transaction into a growing phase (acquiring locks) and a shrinking phase (releasing locks). Because no new locks are acquired after the first release, the execution is conflict-equivalent to some serial order.
The description that a transaction locks an item just before each operation and releases it immediately after each operation is not 2PL. Immediate release after each operation would allow acquiring locks after releases and thus violate the two-phase requirement.
By definition, once a transaction releases any lock it has entered the shrinking phase and cannot obtain any new locks. This is the core 2PL constraint.
Deadlocks can occur under 2PL because transactions may wait for locks held by others, creating cycles (for example, one transaction holds X and waits for Y while another holds Y and waits for X). 2PL ensures serializability but does not eliminate deadlocks.
Summary: The correct statements are the ones asserting that 2PL permits only serializable schedules; that no new locks can be obtained after a lock is released within a transaction; and that deadlocks are possible. The statement about locking and immediately releasing around every operation is incorrect.
A video solution is available for this question — log in and enroll to watch it.