CS FundamentalsModerateProduct-company MCQ pattern
When is a spinlock (busy-waiting lock) preferable to a blocking lock?
- A. On a multiprocessor when the lock is held for a very short time, shorter than two context switches
- B. On a single-CPU system when the lock is held for a long time
- C. When there are more threads than CPUs and the lock is heavily contended for long periods
- D. Whenever the critical section performs disk I/O
Correct answer: A. On a multiprocessor when the lock is held for a very short time, shorter than two context switches
Spinning avoids the cost of sleeping and waking (two context switches). It is useful only if another CPU will release the lock soon; on a uniprocessor the spinning thread just wastes its quantum because the holder cannot run.
More Operating Systems questions
- Modern fork() implementations use copy-on-write. Which statement is correct?
- Segment table (base, limit): S0 (1400, 600), S1 (6300, 400), S2 (4300, 300), S3 (3200, 1100). What happens for logical addresses (2, 120)…
- Page size is 1 KB. The page table maps page 0 → frame 3, page 1 → frame 7, page 2 → frame 5, page 3 → frame 2. What physical address…
- Which statement about threads of the same process is FALSE?
- Processes: A (arrival 0, burst 5), B (arrival 1, burst 3), C (arrival 2, burst 8), D (arrival 3, burst 6). Round Robin, quantum 4. A…
- Processes: P1 (arrival 0, burst 7), P2 (arrival 2, burst 4), P3 (arrival 4, burst 1), P4 (arrival 5, burst 4) (ms). Round Robin with…