What is the main disadvantage of a spinlock?
Correct answer B. A waiting thread wastes CPU cycles by looping until the lock becomes free
A spinlock busy-waits: the thread repeatedly tests the lock instead of sleeping, burning CPU time on a single processor where the holder cannot run meanwhile. On multiprocessors, when locks are held only briefly, spinning can be cheaper than the context switch needed to sleep and wake, which is why kernels use spinlocks for short critical sections.
Answer checked How we write and check questions
Discussion