spawning a child by double forking
Jim C Vlcek
vlcek at athena.mit.edu
Thu Jul 6 11:31:34 AEST 1989
Double-forking to avoid creating zombies or having to wait on children
just don't sit right with me. You fork() because you need another
process, not because you want to hide your trail from something. It's
like bringing two cars on a trip just in case one gets a flat: why go
to all that trouble just to avoid bringing a spare?
Brian Litzinger, in <1668 at apt.UUCP>, sez:
``Ignoring SIGCLD is a wonderful solution for people running System V.
Unfortunately, ignoring SIGCHLD in most BSD systems will not produce
the same result.''
``The reasoning behind the double forking is that it is a more portable
solution than ignoring SIGCLD.''
Steve Summit (I think) recommended trapping SIGC(H)LD (at least our
version of 4.3BSD #defines SIGCHLD SIGCLD), and then waiting on the
expiring child, as a portable solution. This seems to me far better
than double-forking, and doubtless faster. One has the added bonus of
having the exit status of the children easily available -- just in
case you want them later.
Jim Vlcek (vlcek at caf.mit.edu uunet!mit-caf!vlcek)
More information about the Comp.unix.questions
mailing list