CS FundamentalsHardGATE CS
A spin lock is built from an atomic test-and-set: while (TestAndSet(&lock)) ; /* critical section */ lock = false;. Which property does it NOT guarantee on a multiprocessor?
- A. Mutual exclusion
- B. Progress
- C. Atomicity of acquiring the lock
- D. Bounded waiting
Correct answer: D. Bounded waiting
Whichever spinner's test-and-set happens to win after a release gets the lock, so one thread can lose indefinitely: no bounded waiting. Mutual exclusion and progress hold; a ticket lock or a queue of waiters adds fairness.
More Operating Systems questions
- Processes (arrival, burst): P1 (0, 8), P2 (1, 4), P3 (2, 9), P4 (3, 5), P5 (6, 2). Under SRTF (preemptive SJF; a running process keeps the…
- Round Robin with quantum 3; processes (arrival, burst): A (0, 7), B (2, 4), C (4, 6), D (5, 3). A process arriving at the same moment…
- Preemptive priority scheduling (smaller number = higher priority; a running process is not preempted by an equal priority). Processes…
- Non-preemptive SJF; processes (arrival, burst): P1 (0, 3), P2 (5, 6), P3 (6, 2), P4 (7, 1), P5 (8, 4). The CPU idles when nothing is…
- Highest Response Ratio Next (non-preemptive; ratio = (waiting + burst) / burst). Processes (arrival, burst): A (0, 8), B (1, 4), C (2, 2)…
- A multilevel feedback queue has Q0 (RR, quantum 2), Q1 (RR, quantum 4) and Q2 (FCFS); a job that uses its full quantum drops one level…