[Processes in your ps output that are in the <exiting> or Z status are called zombies. -JP]
"What is a zombie?" I hear you ask. "Why should a dead process stay around?"
Dead processes stick around for two principal reasons. The lesser of these is that they provide a sort of "context" for closing , and shutting down other resources (memory, swap space, and so forth). This generally happens immediately, and the process remains only for its major purpose: to hold on to its name and .
A process is named by its process ID or PID. Each process also has associated with it a Parent Process ID. The parent PID is the PID of the process that created it via , or, if that particular process has since vanished, 1 (the PID of ). While the original parent is around, it can remember the PIDs of its children. These PIDs cannot be re-used until the parent knows the children are done. The parent can also get a single byte of from each child. The wait system call looks for a zombie child, then "collects" it, making its PID available and returning that status. The init(8) program is always waiting, so that once a parent exits, init will collect all its children as they exit, and promptly ignore each status.
So, to get rid of a zombie, you must wait for it. If you have already done so or if the process' PPID is 1, the process is almost certainly stuck in aclose routine, and if it remains that way forever, the driver has a bug.
- in comp.unix.questions on Usenet, 16 January 1989
|38.15 Cleaning Up an Unkillable Process||38.17 Automatically Kill Background Processes on Logout in csh|