Zombies ???

David S. Hayes merlin at hqda-ai.UUCP
Tue Dec 9 01:46:18 AEST 1986


A zombie process is the visible artifact of the fact that Unix says
that a parent can read the exit status of a child.  When a child
process exits, a status value is generated.  (If it just returns from
main, it still has an exit value.  Normally zero, but it depends on
your compiler.)  The parent may want to read this status value, but
the child process itself is no longer needed.

When the child dies, its memory resources are reclaimed.  The process
table entry, which contains the exit status, is retained by the
kernel.  The table entry is kept so that the parent may pick up the
exit status (via wait(2)).  While the table entry is being preserved,
its status is ZOMBIE.  When the parent reads the child's exit status,
the remaining table entry for the child is purged from the system.

All processes ZOMBIE for a short time: the time between the process
exit and their parent's wait().  Processes that you see on ps(1) as
ZOMBIE are the result of the parent process exiting before the child,
or exiting without reading the child's exit status.  When this
happens, he child (now considered an "orphan" process) becomes a child
of init (process 1).  The kernel doesn't think about this, though, and
just ZOMBIE's the child as usual.  Init, though, does not check the
exit status either.  Thus, the ZOMBIEs stick around until reboot.

The preceding was discovered on a VAX running 4.2BSD, as a result
of some problem with emacs.  I think Sys V runs the same way, but
I can't be sure, as I don't have a Sys V machine.

-- 
	David S. Hayes, The Merlin of Avalon
	PhoneNet:	(202) 694-6900
	ARPA:		merlin%hqda-ai at brl
	UUCP:		...!seismo!sundc!hqda-ai!merlin



More information about the Comp.unix.wizards mailing list