Spinlocks are often identified as the locking mechanism of choice on multi-processor systems when the lock is to be held for a short duration. But whatexactly constitutes ashort duration? Given that waiting on a lock requirestwo context switches—a context switch to move the thread to the waitingstate and a second context switch to restore the waiting thread once the lockbecomes available—the general ruleis to use a spinlock if the lock will beheld for a duration of less than two context switches.
Spinlock = lock that requires busy waiting