[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CAS and spinlocks (was: Re: [f-cpu] another DATE report)

----- Original Message -----
From: Michael Riepe <michael@stud.uni-hannover.de>
To: <f-cpu@seul.org>
Sent: Monday, March 18, 2002 12:07 PM
Subject: CAS and spinlocks (was: Re: [f-cpu] another DATE report)

> A spinlock protected piece of code should be as short as possible, and
> not contain blocking functions at all. Spinlocks are just a way to make a
> sequence of simple instructions atomic -- like the update operations in
> the stack example, or a software implementation of CAS2 (which would be
> too heavy as a machine instruction -- remember that it has six operands).

Yes but do you agree that you still need to disable interrupts (something you
forget to do in your example) to prevent your sequence from an undesirable
preemptive task switch ? it is not a hazard that Linux does it for its

I think to have a single CAS is a minimum. To have a CAS2 can really boost
compared with its software implementation. But, ok, let us first to try to have
an efficient CAS. Afterward we can try the impossible :-)

To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/