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?
- A. 11
- B. 9
- C. 7
- 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
- A Unix file system contains only these names: directories /, /a, /a/b and /c, a regular file /a/f, and /c/g, which is a hard link to /a/f…
- A user-mode process accesses virtual pages with page-table entries (present, writable, user-accessible): page 0 (1,1,1), page 1 (1,0,1)…
- Locks are ordered L1 < L2 < L3 < L4 and every thread must acquire locks in increasing order. A thread acquires locks in the following…
- Memory (in KB, from address 0): OS 100, process A 150, hole 60, B 200, hole 90, C 120, hole 80, D 100, hole 100. Compaction slides every…
- A 100 MB process is swapped out and later swapped back in on a disk that transfers 50 MB/s with an 8 ms latency per transfer. Swap-out…
- Disk requests arrive as a Poisson stream of 100 per second; service times are exponential (M/M/1 per disk). Option X buys one disk twice…