Start learning →

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._
Practise this question with Quill — GATE CSE →

Keep practising Operating Systems

Browse all Operating Systems questions for GATE CSE, or explore more Computer Science topics.

Start a Operating Systems lesson →
Related questions