CS FundamentalsVery hardGATE CS (PYQ pattern)

Strict two-phase locking with shared locks for reads and exclusive for writes (a transaction already holding S can upgrade to X only if no other transaction holds a lock on the item). Each transaction runs its operations in order and releases all locks only after its last operation. A scheduler repeatedly cycles through T1, T2, T3, T4 in that order, letting each transaction execute at most ONE operation per visit; a transaction whose lock request conflicts simply waits for its next visit. T1: R(A), R(C), W(B); T2: W(B), W(C), R(A); T3: W(C), R(C), R(C); T4: R(A), R(B), W(B). Which transactions never complete?

  1. A. T1, T2, T4
  2. B. T3
  3. C. T1, T2
  4. D. None; every transaction completes

Correct answer: A. T1, T2, T4

Simulating the rounds, a deadlock arises and the transactions T1, T2, T4 stay blocked forever (the rest finish and release their locks).

More DBMS and SQL questions

Exams that ask this topic