Home › GATE CSE › computerscience › Operating Systems › Disabling INTERRUPTS as a way to implement mutua…
Disabling INTERRUPTS as a way to implement mutual exclusion on a single-CPU system is
Athe recommended approach for user-level mutexes
Bfine for short kernel sections, DANGEROUS for long ones
Cmore efficient than test-and-set on all architectures
Dan approach that scales to multi-CPU systems automatically
Answer & Solution
Correct answer: B. fine for short kernel sections, DANGEROUS for long ones
1. OSTEP §28.2 (Controlling Interrupts) discusses this approach.
2. By DISABLING interrupts, the kernel prevents any preemption. On single-CPU systems, this guarantees mutual exclusion (no other thread can run).
3. PROBLEMS:
- LONG critical sections will lose timer ticks (time keeping breaks).
- I/O interrupts are missed → device responses delayed.
- User-mode code CANNOT disable interrupts (privileged).
- Multi-CPU systems: disabling interrupts on one core does NOTHING about other cores.
4. So this approach is reserved for SHORT KERNEL critical sections only.
5. Options A, C, D have wrong characterisations.
_Source: OSTEP Ch 28, §28.2 (Controlling Interrupts), p. 2-3._
Related questions
On a MULTI-CORE system, a SPIN LOCK is generallyA LIVELOCK differs from a DEADLOCK in thatSuppose thread A acquires lock L1, then thread B acquires lock L2. Now A tries to acquire Without atomic hardware support, building a correct mutual-exclusion lock for $N \geq 2$ tA CRITICAL SECTION isLinux's `pthread_mutex_lock()` is typically implemented as a HYBRID:What is the PRIMARY problem with using a SPIN LOCK on a SINGLE-CPU uniprocessor system (wiA LOCK is considered FAIR if