Similar questions 1 more →
Synchronization & Concurrency

Answer & solution
Answer: A (no official key was published)
Atomic test-and-set allows exactly one contender to observe 0 and enter, preserving mutual exclusion. When the current holder eventually leaves and resets X, some contender can acquire it, so the lock is deadlock-free under ordinary progress assumptions. There is no FIFO order or bounded-wait guarantee: the same process can repeatedly win and starve another. Only I holds, A. X denotes shared lock storage in this pseudocode, not an ordinary pass-by-value C local.
The atomic operation returns the old flag and sets it to 1 as one indivisible action. Only one contender can see old 0, so IV is false. Once the holder releases, some waiting process can succeed, assuming the holder and scheduler make ordinary progress; this supplies deadlock freedom. But no queue orders contenders. A newly arriving or repeatedly scheduled process can keep winning before another waiter, defeating both FIFO and starvation freedom. Therefore only I is justified.