forking and zombies in SYSV.

Joergen Haegg jh at efd.lth.se
Mon Aug 20 23:31:07 AEST 1990


A question about how to fork() in SYSV.

I want to fork, and the parentprocess should continue without
doing a wait().
When the child exits, it is transformed into a zombieprocess.
The zombie exists until the parent exits.
This is as it should be according to SVID.

How do I avoid getting this zombie?

The only way, am I told, is to let the child fork again and exit.
The parent will wait() for the first child, but not the child of 
the first child.

The second child will not create a zombie, because the parent 
(the first child) is dead.
This seems a bit silly, because /etc/init forks all the time and without
any zombies. (Ok, init is maybe a little special :-)

Is there not a cleaner way to do this?

-- 
--
Joergen Haegg				jh at efd.lth.se	postmaster at efd.lth.se
System manager @ efd			046-107492
Lund Institute of Technology		Sweden



More information about the Comp.unix.wizards mailing list