CS FundamentalsVery hardProduct company interview · GATE level

Transactions T1, T2 and T3 have timestamps 1, 2 and 3. All read and write timestamps of items A and C are initially 0, and the operations arrive in this order: R3(A); W2(C); W1(C); W2(A). Which transactions are rolled back under basic timestamp ordering, and which under timestamp ordering with Thomas's write rule?

  1. A. Basic: T1 and T2. With Thomas's write rule: T1 and T2
  2. B. Basic: T1 and T2. With Thomas's write rule: T2 only
  3. C. Basic: T1 only. With Thomas's write rule: none
  4. D. Basic: T2 only. With Thomas's write rule: T2 only

Correct answer: B. Basic: T1 and T2. With Thomas's write rule: T2 only

R3(A) sets read-TS(A) = 3. W2(C) sets write-TS(C) = 2. W1(C): T1's timestamp 1 is below write-TS(C) = 2 while read-TS(C) = 0, so it is an obsolete write - basic timestamp ordering rolls T1 back, but Thomas's write rule simply ignores the write and lets T1 continue. W2(A): T2's timestamp 2 is below read-TS(A) = 3, meaning a younger transaction has already read A; this write must be rejected and T2 rolled back under both schemes. Thomas's rule only forgives writes that are too late relative to another write, never relative to a read.

More DBMS and SQL questions

Exams that ask this topic