How to clean out Zombies?

Conor P. Cahill cpcahil at virtech.uucp
Sat Jul 21 13:19:57 AEST 1990


In article <24986.26a58a7a at kuhub.cc.ukans.edu> jian at kuhub.cc.ukans.edu writes:
>   I am writting a program that works like a daemon process. The master
>will run forever on UNIX and listen a port for request calls. In order to 
>make the master process be able to handle multiple calls at the same time, 
>I design the program to spawn out child process to perform work whenever a 
>request call comes. The child process will terminate itself when a clear 
>call signal is received. Here is the problem. When I use "ps ux" shell 
>command to check the status of processes on the system, I found lots of 
>Zombie processes. If I terminate the master process, all of zombies are gone.

Read the Wait*(2) and Signal(2) manual pages for your system.  I can't
tell you exactly what to do since you didnot mention what OS you are 
running.

Essentially what you need to do is call wait() as some point which will
clean up the zombies.  You can set up your daemon to get a signal whenever
a child exits and you can then do the wait() which won't block.

-- 
Conor P. Cahill            (703)430-9247        Virtual Technologies, Inc.,
uunet!virtech!cpcahil                           46030 Manekin Plaza, Suite 160
                                                Sterling, VA 22170 



More information about the Comp.unix.questions mailing list