CS FundamentalsHardGATE CS (PYQ pattern)

Shared x = y = 0. Thread 1: x = 1; y = 1. Thread 2: r1 = y; r2 = x. Thread 3: x = 2; r3 = x. Under sequential consistency, how many distinct outcomes (r1, r2, r3) are possible?

  1. A. 11
  2. B. 9
  3. C. 7
  4. D. 14

Correct answer: B. 9

Enumerating every interleaving of the six memory operations gives 9 different triples (for example r1 = 1 forces r2 to be 1 or 2).

More Operating Systems questions

Exams that ask this topic