Subject: Re: test-and-set
To: Kamal Prasad <>
From: James Buchanan <>
List: tech-kern
Date: 02/10/2003 19:04:58
Oh... I forgot to add.  On i386 systems, the aquisition of the mutex
(the spinlock type = volatile unsigned int spinklock_t) is atomic in
SMP systems because the bus access of the other processors in the
system is locked.  Mostly it is not "fair" in aquisition of the lock,
since one CPU may be spinning waiting for the lock, and doesn't test
it again quick enough after it's released by the CPU that has the
lock, so another CPU may get it.

Presumably it is one of the control registers or something on the
Intel CPUs that blocks other CPU's bus access, but I am not sure.  It
may be only a feature on the motherboard.  I see something about a
cache lock, but I don't understand what it is.

So a spinlock on SMP systems is a simple mutex type, which get be
tested and set in an atomic operation, while other CPUs' bus access is


----- Original Message -----
From: "Kamal Prasad" <>
To: <>
Sent: Monday, February 10, 2003 5:35 PM
Subject: test-and-set

> Hello,
>  I understand that spinlocks are implemented (on i386)
> using test-and-set atomic instructions. can someone
> tell me how it(spinlock) is implemented on
> multi-processor systems?
> thanks
> -kamal
> p.s:- Im not subscribed to the mailing list.
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.