Practice free →
HomeGATE CSEcomputerscienceOperating Systems › On a MULTI-CORE system, a SPIN LOCK is generally

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._
Solve this in the app — GATE CSE practice & 24k+ MCQs →
Related questions