RFR: 8338146: Improve Exchanger performance with VirtualThreads

Doug Lea dl at openjdk.org
Tue Aug 13 14:16:50 UTC 2024


On Tue, 13 Aug 2024 11:52:05 GMT, Viktor Klang <vklang at openjdk.org> wrote:

>> The Exchanger class uses spin-waits that are hostile to some uses of VirtualThreads. Improving this requires a means of estimating whether there are many VirtualThreads with few carriers, which can be supported by adding a method in class ForkJoinWorkerThread. This enables a reworking of the exchange method, and can also be used to deal with similar issues in LinkedTransferQueue and possibly elsewhere. We leave for now open whether this method (hasKnownQueuedWork) should be public, which would allow users to use it in similar contexts, at the possible expense of revealing too much about current VT implementation
>
> src/java.base/share/classes/java/util/concurrent/Exchanger.java line 379:
> 
>> 377:                             if ((v = p.match) != null) {
>> 378:                                 MATCH.set(p, null);
>> 379:                                 break outer;     // spin wait
> 
> Is this comment accurate?

No. Carried over by mistake in a paste. Thanks. Removed.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20554#discussion_r1715375622


More information about the core-libs-dev mailing list