[OT] poll() vs. AIO (was: [PATCH] ash: clear NONBLOCK flag from stdin when in foreground)

Cathey, Jim jcathey at ciena.com
Mon Aug 22 16:51:10 UTC 2011


>I'd like to know how else, other than this ugly SIGCHLD handler, you
>can create a child process without having the keep track of the pid
>and have part of your code be responsible for waiting for it.

Just use the asynchronous waitpid.  Oh, sorry, we're not talking
about DNIX here are we?  :-)  Its kernel would satisfy waitpids
before more generic waits, if multiple wait requests were queued.
(Internally ALL requests are the same, asynchronous, the usual
synchronous API wait point was in the system-to-user transition
code.  Tres elegant.)

>I already explained how this could lead to *unbounded* memory growth
>through leaks that are nearly impossible to fix, unless all your
>forking happens from a common parent that doesn't grow.

The only benefit of the fork helper we were forced to implement is
that the fork cost is less, since the massive application is no longer
the process that forks but rather its quite svelte first child.  These
forks, however, do not inherit any interesting memory state and so
are really only suitable for forks followed by exec.

-- Jim






More information about the busybox mailing list