On Thu, 26 Mar 2026 09:09:11 GMT, Francesco Nigro <[email protected]> wrote:

> Ported from 7ac9ca128885c5dd561e6fbd6bbeaddb86d6264c to the latest upstream 
> fibers branch. Adapted to the current API which renamed 
> implRegister/implDeregister to implStartPoll/implStopPoll and added 
> Mode/EventFD/Cleaner/PollerGroup architecture.

@AlanBateman this implement the same scheme used by go since the semantic of VT 
and goroutines is fairly similar: it works as we always perform a non blocking 
read upfront, which would park VT if EAGAIN is retuned.
Thanks to ET we won't have any epoll_wait to spin loop pollers due to available 
data to read, matching what users can do while interacting with blocking 
streams.
There are few cons:
- the CHM contains all the registered FDs 
- short living FDs won't benefit of this
- if users forget to close a stream this will bloat the CHM (but the OS wasn't 
happy before, too)

The biggest pro is to save 1 syscall per each blocking read, which, with small 
reads and many core, be very relevant: epoll_ctl always acquire a mutex to 
update the RB tree within the kernel and with many cores this can led to 
scalability issues too.

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

PR Comment: https://git.openjdk.org/loom/pull/223#issuecomment-4133038436

Reply via email to