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:30:58PM +0100, Johnny Billquist wrote:

> Hmm. The thing with rwlocks though is that the actual concept is
> just that you have locks that you want to grab, with the expanded
> idea that you can have them at two different levels. read or write.
> There is nothing inherently CAS about that. On a VAX, I can easily
> implement this with native instructions, but it will not be anything
> near a CAS. But now, they are more or less forced to go via a CAS
> anyway, for what I'd consider no good reason.

To re-iterate:

- The cheapest way to implement rwlocks on modern computers is with CAS.

- rwlocks work badly in the real world.  In applications where they do make
  sense other primitives offer a better deal.  For example Linux seqlocks
  or distributed locks with a per-CPU component.  Therefore it doesn't
  make sense to spend time enhancing rwlocks.

Home | Main Index | Thread Index | Old Index