UNIX question
Ron Natalie
ron at BRL.ARPA
Thu Dec 12 02:18:32 AEST 1985
Processes that die stay around until their status gets "inheritted."
If the parent process (the one that did the fork) is still alive,
it must execute a wait system call to get the information. If the
parent dies without waiting for the child, then the child gets
inheritted by the "orphanage" process, init, which once the system
is running is always waiting for processes to die.
Killing these ZOMBIE (dead, but not inheritted) processes is ineffective
since they are already dead. They count against you because until they
are inheritted, they consume one of a finite number of process slots on
the system, which is what the process limit is protecting.
You should fix the parent program such that it either waits for the
dead children, or use the following frequently used kludge:
FORK
if CHILD then
FORK
if CHILD then
EXECUTE SUBPROCESS CODE
else
EXIT
endif
else
WAIT
endif
Here the process forks a second process which forks the spawned job.
The middle process dies, making the spawned job an orphan who will
be eaten by init.
=Ron
More information about the Comp.unix
mailing list