In conservative two phase locking protocol, a transaction
In conservative two phase locking protocol, a transaction
Answer: C. should acquire all the locks at beginning of the transaction — In conservative two-phase locking (2PL), a transaction must acquire all required locks before accessing any data item. This is known as the strict lock…
- A.
Should release exclusive locks only after the commit operation
- B.
Should release all the locks only at beginning of the transaction
- C.
should acquire all the locks at beginning of the transaction
- D.
Should acquire all the exclusive locks at beginning transaction
Attempted by 215 students.
Show answer & explanation
Correct answer: C
In conservative two-phase locking (2PL), a transaction must acquire all required locks before accessing any data item. This is known as the strict lock acquisition phase. Once a transaction starts, it cannot acquire any new locks after releasing any lock. This ensures that the transaction follows a strict two-phase pattern: first, all locks are acquired (growing phase), and then all locks are released (shrinking phase).
The key rule is that exclusive locks must be held until the transaction commits. This prevents other transactions from accessing the same data item until the current transaction completes. This ensures serializability and avoids conflicts.
Therefore, a transaction in conservative 2PL must acquire all locks at the beginning and release them only after commit. This guarantees that no new locks are acquired after any lock is released, maintaining the two-phase property.