New EA builds with changes to object monitor implementation to avoid pinning with virtual threads

Alan Bateman Alan.Bateman at oracle.com
Fri May 31 17:14:42 UTC 2024


We've published new early-access builds from the loom repo [1] with the 
latest changes to the object monitor implementation. The changes means 
that virtual threads don't pin their carrier when parking (doing socket 
I/O for example) while in a synchronized method, blocking entering a 
synchronized method/statement because the object's associated monitor is 
held by another thread, or Object.wait. The changes for 
Object.wait/timed-wait is the main change since the previous EA.

As before, we would like to get help to test the changes. Testing the 
changes means trying out the builds with code that you know is using 
virtual threads and with libraries that are "very synchronized". We need 
to gauge both reliability and performance. Right now, the focus is on 
being functional and reliable, the performance for some cases isn't on 
par right now with blocking on j.u.concurrent locks + condition objects. 
The simplest way to report an issue or feedback is to just send a mail 
here.

As before, JFR events can be used to identify remaining cases of 
pinning, parking or blocking in a class initializer for example. The 
system property jdk.tracePinnedThreads to get stack traces when threads 
are pinned no longer prints anything.

-Alan

[1] https://jdk.java.net/loom/


More information about the loom-dev mailing list