[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Zombies



On Fri, Mar 26, 1999 at 01:21:49PM -0500, Chris Brown wrote:
> I had a few cpio scripts running in background, noticed an error with 
> one of my scripts (it was recursive) and tried to stop it.
> 
> kill pid# did not work. Somewhere along the way the jobs attained the 
> "zombie" status, and kill wouldn't touch them. I finally rebooted.
> 
> Can someone explain what a zombie is and how to kill it?

You cannot kill a zombie process, because it's already "dead".

A zombie process is the child of another process, its "parent" processes.
A zombie is denoted by "<defunct>" in the process name listed by the ps
command.  A child becomes a zombie when its parent fails to wait for it
to exit properly.

Zombie processes do not consume CPU; the scheduler (in the kernel) ignores
them.  I am not sure if they can possess other resources, like memory or
file descriptors; I was once told that they don't, but the manpage for
wait(2) implies that they can use "system resources".

They do, obviously, fill up a slot in your process table, so if you have
tens of thousands of zombie processes on your system they can get to be a
problem.

The good news is, zombie processes are eventually cleaned up by init(1)
after their parent exits.  So unless init itself created the zombie, it
should be possible to get rid of them without rebooting the system.  "ps j
process_id" will help you to identify the parent process and deal with it
appropriately.

Miquel van Smoorenburg (author and maintainer of the sysvinit package), and
lots of other people can probably give you a more technical explanation.

BTW, has anyone else noticed that the manpage for ps(1) is uglier than sin?
Whose idea of nroff formatting is that?

-- 
G. Branden Robinson              |   Reality is what refuses to go away when
Debian GNU/Linux                 |   I stop believing in it.
branden@ecn.purdue.edu           |   -- Philip K. Dick
cartoon.ecn.purdue.edu/~branden/ |

Attachment: pgp4zZI7ZIitm.pgp
Description: PGP signature


Reply to: