What’s a zombie process?

Print anything with Printful



A zombie process is a defunct process that remains in the process table even after it has finished executing. It is usually associated with Unix and similar operating systems. The parent process is responsible for removing it, but if it doesn’t, the zombie process can be removed indirectly by killing the parent. Sometimes, the existence of a zombie process may be intentional or desired. To clear the process table, the kill command can be used to send the SIGCHLD signal to the parent process, which should harvest its zombie children. If the parent process ignores the signal, it can be killed, and any zombies created by it will be assigned to the init process, which periodically runs the wait command on its children to remove any zombies it is responsible for.

A zombie process is an instance of a computer program that maintains a process table record even though it has 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 running, the parent is usually responsible for removing it from the process table. It is usually not possible to directly remove a zombie process with the kill command, although the parent can often be made to remove it if the operator uses signal child notification (SIGCHLD). Otherwise, a zombie process can be removed indirectly by killing the parent.

The zombie trial is a metaphorical descriptive term referring to the walking dead. Defunct processes in Unix® and similar operating systems can be seen as analogous to zombies in that they maintain a presence in the process table 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. Technically, a zombie’s parent process is supposed to reap its children, although this doesn’t always happen.

There are some cases where the existence of a zombie process may be intentional or even desired. After a child process has ceased running, 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 previous child. Some programs may benefit from or even require this type of differentiation.

If a parent process has not issued the wait command to collect the zombies it is responsible for, it may be possible to force the problem. This is usually done via the kill command and sending the SIGCHLD signal to the parent process. If all goes well, a parent process receiving this signal should harvest its zombie children so that their IDs and process table locations can be reused.

Under certain circumstances, a parent process can ignore the SIGCHLD signal. If this occurs and the operator still wants the process table cleared, the parent process can be killed. Any zombies created by the parent process will then be assigned as children to the init process. Since init periodically runs the wait command on its children, any zombies it is responsible for will eventually be removed from the process table.




Protect your devices with Threat Protection by NordVPN


Skip to content