Spinlocks are not appropriate for single-processor systems because a high priority thread will loop indefinitely waiting for a lower priority thread to release a spinlock, wasting CPU time. Spinlocks are used in multiprocessor systems where the owner of a spinlock can continue running on a different processor, avoiding indefinite waits and allowing other threads to access the resource protected by the spinlock.
Explain why spinlocks are not appropriate for single-processor systems.docx
1. Explain why spinlocks are not appropriate for single-processor systems yet are often used in
multiprocessor systems.
Solution
"Spinlocks should not be used on single-processor systems. Consider a high priority thread
which attempts to claim a spinlock already held by a lower priority thread: it will just loop
forever and the lower priority thread will never get another chance to run and release the
spinlock. Even if the two threads were running at the same priority, the one attempting to claim
the spinlock would spin until it was timesliced and a lot of cpu time would be wasted. If an
interrupt handler tried to claim a spinlock owned by a thread, the interrupt handler would loop
forever. Therefore spinlocks are only appropriate for SMP systems where the current owner of a
spinlock can continue running on a different processor. "
check with this below link:
http://ecos.sourceware.org/docs-latest/ref/kernel-spinlocks.html