[M3devel] Latest pthreads attempt

Tony Hosking hosking at cs.purdue.edu
Wed Aug 13 23:47:08 CEST 2014


Yes, indeed.  Unfortunately, only on Linux...

On Aug 13, 2014, at 3:47 PM, Dragiša Durić <dragisha at m3w.org> wrote:

> CAS locking is exactly what is used in futexes so we have that kind of being-thin functionality at least in Linuxes. Futexes are around for more than 10yrs now so I believe it is pretty common already.
> 
> On 13 Aug 2014, at 21:40, Tony Hosking <hosking at cs.purdue.edu> wrote:
> 
>> Tough to get away with that if we wrap pthread mutexes like we do.  But yes, much cheaper on modern thread implementations.  And wrapping allows us to go to a thin-lock implementation using CAS (acquire of an uncontended mutex is simply CAS(ADR(m.holder), NIL, self).  A contended mutex can be detected by setting a low bit in the holder field.  And even better, we can implement biased locking, wherein an uncontended lock is biased towards one particular thread which can lock it without CAS.  Revoking the bias requires stopping the thread holding the bias, clearing it, and resuming.
>> 
>> Need more time...
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20140813/9143553d/attachment-0002.html>


More information about the M3devel mailing list