Main Page | See live article | Alphabetical index

Spinlock

In software engineering, a spinlock is a lock where the thread simply waits in a loop ("spins") repeatedly checking until the lock becomes available.

Spinlocks are very efficient if threadss are only likely be blocked for a short period of time, as they avoid the overhead of operating system process re-scheduling. For this reason, spinlocks are often used within operating system kernels in circumstances where they are likely to be efficient. They are wasteful if the lock is held for a long period of time.