Getting rid of a <defunct> process
Jim Frost
madd at bu-cs.BU.EDU
Mon Feb 13 04:09:12 AEST 1989
In article <102 at avatar.UUCP> kory at avatar.UUCP (Kory Hamzeh) writes:
|I have written an application which forks and execs off many subtasks.
|The main process (the parent which does all of the forks) can not
|do a wait() because I can't get blocked for anything. Well, this results
|in a lot of "<defunct>" processes in the process table when the child
|exits.
|
|Is there any way to get rid of these processes? If not, will they take
|up any core space? I assume they will take up a slot in the process table.
What I usually do is:
fireman() /* catches falling children */
{ union wait wstatus;
while (wait3(&wstatus, WNOHANG, NULL) >= 0)
;
}
main()
{
signal(SIGCHLD, fireman);
/*...*/
}
<defunct> processes (also called "zombies") definitely take up process
table entries and probably take up many more resources. Exactly what
a zombie process holds depends on the operating system implementation.
jim frost
madd at bu-it.bu.edu
More information about the Comp.unix.wizards
mailing list