Similar questions 1 more →
Synchronization & Concurrency





Answer & solution
Answer: Deadlock-free under the usual progress assumptions; not starvation-free. (no official key was published)
With atomic TEST_AND_SET, one contender acquires any free lock, and a holder that finishes its finite critical section releases the lock. Under the usual assumptions that a holder continues to receive execution time and eventually exits, the lock is deadlock-free: processes do not remain mutually blocked with no one able to proceed. It is not starvation-free, since a waiting process is not assigned a turn. Each time the lock is released another contender can acquire it first, so one process can lose indefinitely even while other processes keep making progress. As with any spinlock, a scheduler that prevents the holder from running can itself defeat progress; deadlock-freedom is not an unconditional scheduling guarantee.