[plt-scheme] subprocess: double fork() to avoid zombies
On Jul 21, Tom Schouten wrote:
> Hello,
>
> I'd like to pick up this thread:
> http://list.cs.brown.edu/pipermail/plt-scheme/2008-July/025637.html
>
> On Tue Jul 1 2008, Eli Barzilay wrote:
> > My guess would be that the subprocess object gets released, but the
> > process is still alive, which leads to the zombie. (The main problem
> > being that custodians manage memory & ports, but not processes.)
>
> I was wondering if it is possible to extend `subprocess' with
> a double fork() mechanism. I had a look at the code in
> plt/src/mzscheme/src/port.c and it seems it should be
> straightforward. Something like this:
>
> [mzscheme]--fork()-+-------wait()-----------------+--------->
> | |
> +--cleanup()--fork()-+--exit()-+
> |
> +--exec()-[child]--->
>
> in addition to the current behaviour:
>
> [mzscheme]--fork()-+---------------------------------------->
> |
> +--cleanup()------------exec()-[child]--->
>
>
> The idea being that in a lot of practical cases you don't care about
> a child's exit status. Doing it like this still allows you to shut
> down a child by closing its input port, which by most tools is
> interpreted as "exit", without ever having to care about zombie
> processes caused by not performing wait().
How is this different? Specifically, you have wait() synchronising on
the forking subprocess, but you still need a different wait() for the
child that it creates -- no?
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!