From: Ken Pizzini (ken@halcyon.com)
Date: 04/22/93


From: ken@halcyon.com (Ken Pizzini)
Subject: Re: Zombie Processes
Date: 22 Apr 1993 17:53:28 -0700

In article <1993Apr22.182508.7143@sol.ctr.columbia.edu> jerry@msi.com (Jerry Shekhel) writes:
> I have a sequence of events which seems to create zombie processes:
> Process A spawns Process B
> Process A exec()'s another program
> Process B terminates
> Process B becomes a zombie
>
>That is, it seems like if a process terminates while its parent is still
>running but has exec()'ed another program, it turns into a zombie. When
>the parent dies, the system cleans up the zombie.

No, all it takes is a parent process, or its exec()'d reincarnations,
to fail to do a wait() for the child process when the child terminates.
When the parent dies, process 1 (init) inherits the child. Init is
always waiting for its children (natural or adopted), so the zombie
is promptly cleaned up.

>Is this correct behavior?
Yes. The zombie process holds the exit status so that should the parent
ever deems to wait() it'll get the exit status. The only resource
being consumed by the zombie is a process slot -- no pages/page-table entries,
no file descriptors/inode table entries, etc.

                --Ken Pizzini