What is a Zombie Process?
A zombie process is an instance of a computer program that retains a process table record despite having finished executing. Defunct processes like these are typically associated with Unix® and other similar operating systems due to the way they handle child processes. When a child process has finished executing, the parent is typically responsible for removing it from the process table. It is usually not possible to directly remove a zombie process with the kill command, though the parent can often be made to remove it if the operator uses the signal child (SIGCHLD) notification. Failing this, a zombie process may be removed indirectly by killing the parent.
Zombie process is a metaphorical descriptive term that makes reference to the living dead. Defunct processes in Unix® and similar operating systems can be seen as analogous to zombies in that they maintain a process table presence despite no longer performing their intended functions. When a process has finished executing it is sometimes said to have died, while the means by which the operating system recovers its process table allocation may be known as reaping. The parent process of a zombie is technically supposed to reap its children, though this does not always happen.
There are certain cases where the existence of a zombie process may be intentional or even desired. After a child process has ceased execution, the parent may need to run another instance of the same program later. If a zombie has not been removed from the process table, a new child will not be assigned the same identification (ID) as the old child. Certain programs may benefit from or even require this sort of differentiation.
If a parent process has not executed the wait command to reap zombies it is responsible for, it may be possible to force the issue. This is typically done via the kill command and sending the SIGCHLD signal to the parent process. If everything is working properly, a parent process that receives this signal should reap its zombie children so that their IDs and process table positions can be reused.
Under certain circumstances, a parent process may ignore the SIGCHLD signal. If this occurs and the operator still desires that the process table be cleared, the parent process may be killed. Any zombies that the parent process created will then be be assigned as children to the init process. Since init periodically initiates the wait command on its children, any zombies it is responsible for will eventually be removed from the process table.
Discuss this Article
Post your comments