On a MULTI-CORE system, a SPIN LOCK is generally
Aalways bad
Bthe same as a mutex on uniprocessors
Cless efficient than disabling interrupts
Duseful for VERY SHORT critical sections on other cores
Answer & Solution
Correct answer: D. useful for VERY SHORT critical sections on other cores
1. On a multi-core system, the lock holder can be running on a DIFFERENT CORE than the spinner.
2. So the spinner waits BRIEFLY (the few microseconds it takes the holder to finish its critical section) — at which point the lock becomes free and the spinner acquires it.
3. No context switches, no system calls — very fast for SHORT critical sections.
4. This is why the LINUX KERNEL uses SPINLOCKS heavily in interrupt handlers and short kernel paths.
5. For LONG critical sections (more than a few microseconds), blocking locks (mutex with sleep) are better.
6. Options A, C, D mischaracterise the multi-core case.
_Source: OSTEP Ch 28, §28.9 (Performance — multiprocessor case), p. 7._
Keep practising Operating Systems
Browse all Operating Systems questions for GATE CSE, or explore more Computer Science topics.
Related questions
A LIVELOCK differs from a DEADLOCK in thatSuppose thread A acquires lock L1, then thread B acquires lock L2. Now A tries to acquire A CRITICAL SECTION isA LOCK is considered FAIR ifA LOCK (mutex) is used by concurrent threads toWhich of the following is NOT typically minimised by a CPU scheduler?The PRIMARY DISADVANTAGE of FIFO scheduling isJobs A (run time 100, arrival 0), B (run time 10, arrival 0), C (run time 10, arrival 0) u