GATE / CS ARCHIVE

GATE CSE 2024 SET 2 / QUESTION 27

Growing and shrinking phases in 2PL

Database Management Systems · Transactions & Concurrency Control · Full GATE CSE 2024 Set 2 paper

GATE 2024 Set 2, Q27 1 mark · MSQ
Report issue

Transactions & Concurrency Control

Question 27, GATE 2024: Which statements about two-phase locking are true? A it permits only serializable schedules; B every operation locks just before and releases immediately after; C after the first lock release a transaction can acquire no new lock; D deadlock can occur.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A, C, D

Approach: Apply the no-new-locks-after-release rule and distinguish serializability from progress.

1. Derivation. Two-phase locking first acquires locks and then, after the first release, only releases locks. The no-new-locks shrinking-phase rule proves C. Ordering transactions by their lock points proves conflict serializability, hence A. It does not release every lock immediately after each operation, and deadlock is possible: T1 holds X and waits for Y while T2 holds Y and waits for X. Thus A, C, D.

2. Explanation and checks. The growing phase permits acquisition but no release; the shrinking phase permits release but no acquisition. The instant at which a transaction acquires its final lock is its lock point; ordering transactions by such points is consistent with every conflicting dependency, giving a serial order. Holding X while waiting for Y and holding Y while waiting for X obey the growing-phase rule, so 2PL can still deadlock. Releasing each lock immediately, as B claims, would prevent later acquisitions and is not the general protocol.

Original paper, page 19 · Answer key