Skip to content
Official PYQ · 2024

GATE CS 2024 Set 2 Q17 — Transactions and Concurrency Control

Explain with AI

​​​​Which of the following statements about the Two Phase Locking (2PL2 \mathrm{PL}) protocol is/are TRUE?

Select all correct options
View worked solution

Answer: A;C;D

Let us analyze each statement regarding the Two-Phase Locking (2PL) protocol:

  • Statement A: 2PL2\text{PL} permits only serializable schedules (TRUE)
    The fundamental theorem of 2PL states that any schedule generated by a set of transactions adhering to the 2PL protocol is guaranteed to be conflict serializable, and therefore serializable.

  • Statement B: With 2PL2\text{PL}, a transaction always locks the data item being read or written just before every operation and always releases the lock just after the operation (FALSE)
    If a transaction releases a lock immediately after an operation and later attempts to acquire another lock, it violates the 2PL rule. In 2PL, all lock acquisitions must precede any lock releases.

  • Statement C: With 2PL2\text{PL}, 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 (TRUE)
    This is the defining property of 2PL. A transaction is divided into two phases:
    1. Growing Phase: The transaction may obtain locks but cannot release any.
    2. Shrinking Phase: The transaction may release locks but cannot obtain any new ones.
    Thus, as soon as the first lock is released, the transaction enters the shrinking phase and can no longer acquire any new locks.

  • Statement D: A deadlock is possible with 2PL2\text{PL} (TRUE)
    Basic 2PL does not prevent deadlocks. For example, consider two transactions:
    • T1T_1 locks data item XX and waits to lock YY.
    • T2T_2 locks data item YY and waits to lock XX.
    Both transactions will wait for each other indefinitely, resulting in a deadlock.

Therefore, statements A, C, and D are TRUE.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Transactions and Concurrency Control questions