tech-kern archive

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

Re: mutexes, locks and so on...

On 11/12/10 15:00, Johnny Billquist wrote:
On 11/12/10 14:55, Joerg Sonnenberger wrote:
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.

Well, masking interrupts is not enough, but anyway... Don't look like it
would gain me anything moving from CAS to RAS.

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.

Yes, but then we are not talking about locks. :-)

(Oh, and by the way, lists can be managed atomic and MP safe on VAXen with a single instruction, don't I wish I could use that... :-) )


Home | Main Index | Thread Index | Old Index