CS FundamentalsVery hardGATE CS (PYQ pattern)

Three transactions each run x = x + 10 as an unprotected read followed by a write of (value read + 10), on a shared x that starts at 0, with arbitrary interleaving of the reads and writes and no locking. Which set is exactly the set of possible final values of x?

  1. A. {10, 20, 30}
  2. B. {30}
  3. C. {20, 30}
  4. D. {0, 10, 20, 30}

Correct answer: A. {10, 20, 30}

30 occurs when no updates are lost. A final value of 10 occurs when the last write overwrites with a stale read, e.g. all three read 0 and write 10, and 20 when two updates survive. 0 is impossible since every write stores at least 10.

More DBMS and SQL questions

Exams that ask this topic