<div dir="ltr"><div dir="ltr">It looks like AbstractQueuedSynchronizer#acquire(...) does appear to do some spinning IIUC, but it's probably quite different to the spinning strategy used by contended monitors. I'm just guessing though.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 21 Jun 2024 at 20:45, Alan Bateman <<a href="mailto:Alan.Bateman@oracle.com">Alan.Bateman@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
On 21/06/2024 16:57, Matthew Swift wrote:<br>
> :<br>
><br>
> These results are on my laptop (Intel i9-13900H with 10 cores, Linux <br>
> 6.5, JDK 21.0.3), but we see similar regressions on larger older <br>
> machines in our labs. Also worthy of note is that the context <br>
> switching rate increases from around 180K/s when using synchronized() <br>
> to 300K/s when using ReentrantLock. I know that ReentrantLock is <br>
> supposed to be a little bit less efficient in highly contended <br>
> situations, but I was surprised by an 8-10% impact. Is that expected?<br>
<br>
One thing that might be part of this is that a contented monitor enter <br>
does a small amount of spinning. Sergey Kuksenko may have some comments <br>
on this as he has some proposals on this at one point.<br>
<br>
-Alan<br>
</blockquote></div></div>