<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Yes, indeed.  Unfortunately, only on Linux...<br>
<br><div><div>On Aug 13, 2014, at 3:47 PM, Dragiša Durić <<a href="mailto:dragisha@m3w.org">dragisha@m3w.org</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">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.<div>
<br><div><div>On 13 Aug 2014, at 21:40, Tony Hosking <<a href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span style="font-family: Constantia; font-size: 18px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">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.</span><br style="font-family: Constantia; font-size: 18px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br style="font-family: Constantia; font-size: 18px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: Constantia; font-size: 18px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">Need more time...</span></blockquote></div><br></div></div></blockquote></div><br></body></html>