-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use a more efficient strategy for waiting on processes #49
Comments
Will look into this |
How this would probably be done:
|
Sorry for the delay! |
@mamaicode Great! Let me know if you need any guidance; I can hop in a Matrix/Discord call for pair programming if needed. |
|
I was looking to contribute the wait implementation for BSD systems but after giving it a try with the @notgull Any idea of how we could solve this issue? The async-io crate registers the process to wait for using the Process structure which does not own the Child struct, instead it relies on its pid and a Child reference. Would it be feasible to add a new/modify |
I think this could be solved by giving the |
The thing is that the Child ownership in the Exit struct is given to the impl QueueableSealed for Exit {
fn registration(&mut self) -> Registration {
Registration::Process(self.0.take().expect("Cannot reregister child"))
}
} https://github.com/smol-rs/async-io/blob/master/src/os/kqueue.rs#L252 |
I think the solution here is to use |
Right now, we use
SIGPROC
to wait for process events on Unix and thread pooling to wait for process events on Windows. This is a very inefficient strategy that doesn't scale for many child processes, like usingpoll()
for I/O notification.Most operating systems have better ways of handling events like this.
pidfd
, which can be registered directly intoasync-io
.EVFILT_PROC
, which is now exposed inasync-io
.async-io
. They can also be made more efficient on thepolling
side, see Support waitable objects on Windows 10 async-io#25The text was updated successfully, but these errors were encountered: