tech-kern archive

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

Re: mutexes, locks and so on...

On Fri, Nov 12, 2010 at 02:35:59PM +0100, Johnny Billquist wrote:
> Augh! And in which way would that improve things? Restarting
> operations, as well as checking if they should be restarted will
> hardly be cheaper than emulating CAS.

It is one way to emulate CAS. The price is loading the return address
and doing a compare -- as opposed to masking interrupts in the CAS
implementation at the omoment.

> And while it is true that CAS is the common, and very popular,
> low-level primitive in the litterature today, I fail to see the
> relevance. When we talk about locks, we should be talking in terms
> of acquiring and releasing the lock, not how it might be implemented
> at a lower level.

Atomic ops are used by other things as well like counter updates without
mutexes. Things like lock-less lists can be implemented on top of CAS
and the lock-less property is important as it makes it possible to use
them from interrupt handlers etc.


Home | Main Index | Thread Index | Old Index