Start learning →

A LOCK is considered FAIR if

Aall threads acquire the lock equally fast
Bevery thread can acquire the lock without contention
Cthe lock is held forever once acquired
Dwaiting threads acquire it in FIFO order
Answer & Solution
Correct answer: D. waiting threads acquire it in FIFO order
1. OSTEP §28.6 evaluates locks on three criteria: correctness, performance, and FAIRNESS. 2. FAIRNESS: as the lock is contested, do all waiting threads get a turn? Or do some threads get starved indefinitely? 3. A FAIR lock typically uses FIFO ordering (queue-based) so the longest-waiting thread acquires the lock next. 4. UNFAIR locks (like simple spin-locks) may starve threads: in high contention, the thread that was JUST preempted might re-acquire the lock immediately on resumption, starving others. 5. Linux's MCS lock and ticket lock are fair; simple test-and-set spinlocks are not. 6. Options A, C, D describe other properties or wrong concepts. _Source: OSTEP Ch 28, §28.6 (Evaluating Locks — Fairness), p. 4-5._
Practise this question with Quill — GATE CSE →

Keep practising Operating Systems

Browse all Operating Systems questions for GATE CSE, or explore more Computer Science topics.

Start a Operating Systems lesson →
Related questions