sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Unnecessary thread and pipe overhead waiting for child processes to exit on Linux and Mac

Open rmacnak-google opened this issue 6 months ago • 1 comments

On Linux and Mac, to wait for a child process's exit code, dart:io creates a separate thread to call wait and separate pipes to communite the result back to epoll or kqueue. This thread and these pipes are unnecessary. On Linux, epoll can directly watch a pidfd, and a pidfd can be atomically obtained by calling clone instead of fork. On Mac, kqueue can directly watch the pid.

rmacnak-google avatar Jun 03 '25 18:06 rmacnak-google

This requires 5.3+ kernel version and I think our supported targets cover some OSes with 4.x kernels e.g. Flutter claims support for Debian 10 which I think comes with 4.19 kernel version.

Dart SDK only claims to support LTS versions of Debian and Ubuntu under standard support, which means Debian 11 and Ubuntu 22.04, both of which have 5+ kernels.

Given that Debian 10 is out of LTS we should drop it from the list of supported targets, which I think means we can probably start assuming 5.10 Kernel as the lowest version.

cc @mit-mit as I think you own platform compatibility tables.

mraleph avatar Jun 04 '25 07:06 mraleph