Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!vsi1!daver!apt!brian From: brian@apt.UUCP (Brian Litzinger) Newsgroups: comp.unix.questions Subject: Re: spawning a child by double forking Message-ID: <1668@apt.UUCP> Date: 5 Jul 89 08:21:42 GMT References: <12376@bloom-beacon.MIT.EDU> Organization: APT Technology, Inc., San Jose, CA Lines: 32 From article , by jeffl@berick.uucp (Jeff Lawhorn): > ] Thus far, two people have suggested that one way to prevent zombie > ]processes from building up is to fork twice instead of once when > ]starting a child -- the child of the first fork forks again and then > ]immediately exits. The "grandchild" which results is inherited by > ]init, which takes care of cleanup, and the parent therefore doesn't > ]have to worry about cleaning up. > > There is a better way to do this. Have the parent ignore the > signal SIGCLD. My man page for signal states: > It is interesting how these discussions can become circular. 8-) I believe this discussion originated from my posting regarding a problem I was having with the creation of zombie processes. Ignoring SIGCLD is a wonderful solution for people running System V. Unfortunately, ignoring SIGCHLD in most BSD systems will not produce the same result. Note: BSD SIGCHLD generally equals System V SIGCLD. The reasoning behind the double forking is that it is a more portable solution than ignoring SIGCLD. The discussion then seemed to move to the effeciency of double forking and maybe using vfork(). <> Brian Litzinger @ APT Technology Inc., San Jose, CA <> UUCP: {apple,sun,pyramid}!daver!apt!brian brian@apt.UUCP <> VOICE: 408 370 9077 FAX: 408 370 9291