CS FundamentalsVery hardGATE CS (PYQ pattern)

Under strict two-phase locking (shared locks for reads, exclusive for writes, all locks held until commit; a transaction whose lock request conflicts must wait, so a schedule is allowed only if no request ever conflicts), which of these schedules can be produced? All four are conflict-serializable. (A) R3(X), W2(Y), W3(Y), R2(X), R3(X), C2, R3(Y), C3 (B) W3(Y), W3(X), R3(X), R1(Y), R3(X), C1, R3(X), C3 (C) R1(Y), C1, R3(X), W3(X), R2(X), R3(X), C3, R2(Y), C2 (D) W2(Y), W3(X), W2(Y), C3, W1(X), C2, R1(X), R1(Y), C1

  1. A. (D)
  2. B. (A)
  3. C. (B)
  4. D. (C)

Correct answer: A. (D)

Check each schedule for a read or write by one transaction on an item that another still-uncommitted transaction has read-locked (for a write) or write-locked (for any access). Only one schedule has no such conflict; the others are serializable but need locks to be released early.

More DBMS and SQL questions

Exams that ask this topic