On Mon, 17 Jan 2005, Satya wrote:
On Mon, Jan 17, 2005 at 04:00:58PM +0530, Rajendra Prasad Murakonda wrote:
On Mon, 17 Jan 2005, Vinayak Hegde wrote:
You need to fix the badly written application. Fix the disease and not the symptom.
I disagree with you. Its not that if an application is resulting in a zombie process, its a bad application. As far as I remember zombies are used for accounting purposes etc. Child process want parent to note down some information about the child before it dies, so it enters zombie state by leaving a record containing an exit code and some statistics for its parent to collect. The parent on the exit, notes down the info and send a signal to the init so that it will remove the zombie entry in the process table.
The parent is supposed to use the wait() or waitpid() call. I'm not sure if there's another way to reap the child processes.
A process goes to zombie state on its exit, when the parent is yet to call wait(2).
I think one of the ways to kill zombie is to kill the parent process.
And when the parent is init, as often happens?
Its not possible. There are two cases...
Logically all the processes that inherit from init should become zombies as all of them terminate before init. But init has a special mechanism to wait whenever one of its child exits.
Second case is what if a process is exiting and has some zombies and some other alive processes. The processes that are alive will become children of init and the zombie processes entries will be removed from the process table.
Technically almost all the processes in the unix environment comes to the zombie state on their exit. Zombie is not a bad thing, its the design, its there for a cause, I think.
Thanks & Regards, -- Rajendra Prasad Murakonda, ETU division, C-DAC Mumbai (erstWhile NCST). Off Phone : 91 22 27565303 extn : 302 Mobile(WLL) : 0 93235 83185 rajncst@yahoo.co.in , rajendra.prasad@gmail.com