Zombie

From Hackepedia
Revision as of 12:28, 31 May 2008 by Pbug (talk | contribs) (sample zombie)
Jump to navigationJump to search

A zombie process is a process awaiting collection by a parent. To clean them up the parent process reaps the child with the wait(2) syscall, it knows when to do this because the kernel notifies it that the child has entered zombie state by means of the SIGCHLD signal. Orphaned processes are reaped by init.

A zombie in the process list (ps) is indicated with flag Z, here is an example of a user initiated zombie:

francisco$ ps ax|grep zombie
16912 p2  Z       0:00.00 (zombie)
16788 p2  I       0:00.01 ./zombie
27973 p2  R+      0:00.00 grep zombie (ksh)
francisco$ kill 16788
[1] + Terminated           ./zombie 

The program is very simple it forks and the child exits immediately, the parent is in an endless loop. As soon as the parent is killed init inherits the zombie child and it waits on it making it disappear.