Thin Lock Implementation

Leandro Lucarella llucax at gmail.com
Fri Aug 22 11:08:28 PDT 2008


Bartosz Milewski, el 20 de agosto a las 15:14 me escribiste:
> Brad Roberts wrote:
> >I'll agree that inbetween is relatively rare, but just because there's 
> >contention, doesn't require the switch to heavy locks.  In a lot of the code I 
> >have written, one spin (assuming the spin utilizes rep; nop;) is sufficient for 
> >the 'blocked' acquire to finish it's acquire.  The use of heavy weight locks in 
> >that scenario is a net loss.
> 
> A thin lock is not a spin lock. It's an optimization on top of the OS lock 
> specifically for the no-contention case. If there is contention, the OS lock, 
> which is part of FatLock, is used. It presumably does its own optimizations, so 
> calling it "heavy weight" may be unfair.

I would love to hear you point on optimizing an OS lock that is already
optimized.

Is that really necessary? Do you have numbers that back you up?

Thank you.

-- 
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
----------------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------------
aFR [afr at my.farts.cause.nuclear.reaction.org] has quit IRC (Ping timeout)



More information about the Digitalmars-d mailing list