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?
- A. T1, T2, T4
- B. T3
- C. T1, T2
- 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
- Transactions T1..T5 have timestamps equal to their numbers (T1 is oldest). Seven independent lock conflicts occur, written (requester…
- Log (LSN: record): 1: T1 update P1; 2: T2 update P2; 3: T1 update P3; 4: begincheckpoint, whose endcheckpoint records ATT = {T1, T2} and…
- Log (LSN: record): 1: T1 update P1; 2: T2 update P2; 3: T1 update P3; 4: begincheckpoint, whose endcheckpoint records ATT = {T1, T2} and…
- A system uses UNDO-only logging; log records <T,item,old value> hold the value BEFORE the update. Log: <T1 start>, <T1,A,10>, <T2 start>…
- T1: R1(X), W1(Y), C1 and T2: W2(X), R2(Y), C2. Of all interleavings, let s be the number that are strict schedules (no read or write of an…
- A wait-for graph over T1..T5 has edges T1→T2, T2→T3, T3→T1, T2→T4, T4→T1, T3→T5, T5→T2, T4→T5. How many distinct simple directed cycles…