spinlocks

Cameron Simpson (cs@zip.com.au)
Wed, 23 Sep 1998 12:28:49 +1000 (EST)


On 22 Sep 1998, in message <199809220752.DAA10054@raptor.cqi.com>
RHS Linux User <humbubba@raptor.cqi.com> wrote:
| > What's a spinlock? It's not in the glossary of Rubini's very cost-effective
| > book.

A spinlock is for very small short-term locks in a multiprocessor situation.

Basicly your normal lock (semaphore, whatever) involves blocking the
thread and scheduling another and then later rescheduling this one (if
the lock isn't free, of course). High latency and high cost for very
small things like atomic access to a counter or suchlike.

A spinlock is based on the premise that when the operation the lock protects
is fast, it's much more efficient to sit in a tight loop polling the lock
with a test-and-set instruction until it comes free.

--
Cameron Simpson, DoD#743        cs@zip.com.au        http://www.zip.com.au/~cs/

A foolish consistency is the hobgoblin of little minds. - Emerson

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/