RFR: 8318422: Allow poller threads be virtual threads
Michael McMahon
michaelm at openjdk.org
Thu Nov 2 15:02:14 UTC 2023
On Wed, 18 Oct 2023 10:31:32 GMT, Alan Bateman <alanb at openjdk.org> wrote:
> 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.
src/java.base/share/classes/sun/nio/ch/Poller.java line 44:
> 42: */
> 43: abstract class Poller {
> 44: private static Pollers POLLERS;
Suggestion:
private static final Pollers POLLERS;
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16243#discussion_r1378920960
More information about the nio-dev
mailing list