RFR: 8338146: Improve Exchanger performance with VirtualThreads

Doug Lea dl at openjdk.org
Mon Aug 12 17:12:41 UTC 2024


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

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

Commit messages:
 - Merge branch 'openjdk:master' into JDK-8338146
 - Copyedit
 - Address review suggestions
 - Initial re-implementation

Changes: https://git.openjdk.org/jdk/pull/20554/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=20554&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8338146
  Stats: 423 lines in 3 files changed: 94 ins; 172 del; 157 mod
  Patch: https://git.openjdk.org/jdk/pull/20554.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20554/head:pull/20554

PR: https://git.openjdk.org/jdk/pull/20554


More information about the core-libs-dev mailing list