<div dir="ltr">Hi,<div><br></div><div>There is an interesting discussion going on about the "correct" use of spinlocks in user space applications on Linux on the LKML. That discussion prompted me to check the OTP source on how locks are implemented.<br></div><div>Some of the arguments of the LKML discussion would seem to apply to the spinlocks (and maybe event the mutexes) used in Erlangs ERTS as well.</div><div><br></div><div>The main takeaway seem to be this quote from Linus:</div><div><br></div><div>> <span style="color:rgb(51,51,51);font-family:Arial,Helvetica,Tahoma,sans-serif;font-size:14px">I repeat: </span><b style="color:rgb(51,51,51);font-family:Arial,Helvetica,Tahoma,sans-serif;font-size:14px">do not use spinlocks in user space, unless you actually know what you're doing</b><span style="color:rgb(51,51,51);font-family:Arial,Helvetica,Tahoma,sans-serif;font-size:14px">. And be aware that the likelihood that you know what you are doing is basically nil.</span></div><div><span style="color:rgb(51,51,51);font-family:Arial,Helvetica,Tahoma,sans-serif;font-size:14px"><br></span></div><div><span style="color:rgb(51,51,51);font-family:Arial,Helvetica,Tahoma,sans-serif;font-size:14px">Could any of the Erlang gurus or ERTS developers comment on the use of home grown mutexes and spinlocks in Erlang in light of that discussion?</span><br></div><div><br clear="all"><div>Blog post that started it: <a href="https://probablydance.com/2019/12/30/measuring-mutexes-spinlocks-and-how-bad-the-linux-scheduler-really-is/">https://probablydance.com/2019/12/30/measuring-mutexes-spinlocks-and-how-bad-the-linux-scheduler-really-is/</a><br></div><div>Linus's response: <a href="https://www.realworldtech.com/forum/?threadid=189711&curpostid=189723">https://www.realworldtech.com/forum/?threadid=189711&curpostid=189723</a><br>Author's response: <a href="https://www.realworldtech.com/forum/?threadid=189711&curpostid=189747">https://www.realworldtech.com/forum/?threadid=189711&curpostid=189747</a><br>Linus follow up: <a href="https://www.realworldtech.com/forum/?threadid=189711&curpostid=189755">https://www.realworldtech.com/forum/?threadid=189711&curpostid=189755</a><br>Linus additional follow up: <a href="https://www.realworldtech.com/forum/?threadid=189711&curpostid=189759">https://www.realworldtech.com/forum/?threadid=189711&curpostid=189759</a><br></div><div><br></div><div>Many thanks</div><div>Andreas</div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><p><span style="font-family:verdana,geneva,sans-serif;font-size:10pt">Andreas Schultz<br></span></p>
</div></div></div>