GATE CS 2024 Set 2 — Question 27
MSQ+1 / -0MediumTwo-Phase LockingTransactions & ConcurrencyDatabases
Databases → Transactions & Concurrency → Two-Phase Locking
Last updated
Question
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
Correct answer
(A) 2PL permits only serializable schedules; (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
Solution
(A) TRUE: The Two Phase Locking (2PL) protocol guarantees conflict serializability. Any schedule allowed by 2PL is serializable.
(B) FALSE: This statement describes a locking strategy that does not follow the two-phase rule. In 2PL, a transaction must acquire all necessary locks (Growing Phase) before it releases any lock. It cannot release a lock "just after the operation" if it intends to acquire more locks later.
(C) TRUE: This is the definition of the Shrinking Phase in 2PL. Once a transaction releases a lock, it enters the shrinking phase and cannot acquire any new locks.
(D) TRUE: 2PL does not prevent deadlocks. Transactions can wait for each other in a cycle (e.g., T1 holds A and waits for B, T2 holds B and waits for A) while adhering to 2PL rules.
(B) FALSE: This statement describes a locking strategy that does not follow the two-phase rule. In 2PL, a transaction must acquire all necessary locks (Growing Phase) before it releases any lock. It cannot release a lock "just after the operation" if it intends to acquire more locks later.
(C) TRUE: This is the definition of the Shrinking Phase in 2PL. Once a transaction releases a lock, it enters the shrinking phase and cannot acquire any new locks.
(D) TRUE: 2PL does not prevent deadlocks. Transactions can wait for each other in a cycle (e.g., T1 holds A and waits for B, T2 holds B and waits for A) while adhering to 2PL rules.
More questions on Transactions & Concurrency
2024 Set 2 Q19Once the DBMS informs the user that a transaction has been successfully completed, its effect…2024 Set 1 Q20Let S be the specification: "Instructors teach courses. Students register for courses. Courses are…2024 Set 2 Q20In the context of owner and weak entity sets in the ER (Entity-Relationship) data model, which one…2024 Set 1 Q21In a tree, the requirement of at least half-full (50%) node occupancy is relaxed for which…2024 Set 1 Q22Which of the following statements about a relation in first normal form (1NF) is/are…
Practice GATE CS PYQs with adaptive difficulty
Timed practice, skill tracking, and AI explanations — free to start.
Start practicing free