RFR: 8318422: Allow poller threads be virtual threads

Alan Bateman alanb at openjdk.org
Thu Nov 2 15:02:12 UTC 2023


Virtual threads doing blocking I/O rely on poller threads to unpark virtual threads when sockets are ready for I/O. Right now, the poller threads are dedicated platform threads that block waiting for I/O events. In some environments it would be better to have the poller thread be virtual threads so that handling of I/O events integrates better with the virtual thread scheduler and doesn't steal cycles from the carrier threads.

The changes to support this are straight forward but it has required refactoring the internal Poller class so the changes might look more than they actually are. The changes mean the Poller implementation supports two modes. The default is changed on Linux to use the "virtual thread poller" mode. The default on other platforms is to use platform threads as before. As part of the refactor, the so-called "indirect" mode with updater threads is removed. This mode came from experimenting in the loom repo a long time ago and probably should have been removed before integration.

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

Commit messages:
 - Sync up changes from loom repo
 - Merge
 - Merge
 - Initial commit

Changes: https://git.openjdk.org/jdk/pull/16243/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16243&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8318422
  Stats: 542 lines in 12 files changed: 167 ins; 198 del; 177 mod
  Patch: https://git.openjdk.org/jdk/pull/16243.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/16243/head:pull/16243

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


More information about the nio-dev mailing list