Linux process: zombie
What a zombie process is
When one program starts another, the starter is called the parent and the new program is its child. After a child finishes, the parent still needs to collect a small result that says how it ended. Until that happens, Linux keeps a record called a zombie. The child itself is already gone: it cannot run, use CPU, or continue working.
To look at a process, use ps with its process ID (PID), the number Linux uses to identify a running process:
ps -o pid,ppid,stat,etime,comm -p 1234
Replace 1234 with the PID you are checking. STAT commonly shows Z or defunct for a zombie. PPID is the parent process ID. The entry may disappear while you inspect it if the parent collects the child's status. You can also see the state in /proc/1234/status or /proc/1234/stat.
Why Linux keeps the record
When a child exits, Linux releases most of its resources, including its memory map and open files. It keeps the process identity and exit result so the parent can read them with wait(), waitpid(), or a related interface; some wait interfaces can also report the child's resource use. Once the parent collects the result, the zombie record disappears and the PID may eventually be reused. A brief delay before the parent waits is normal; a long-lived zombie can mean the parent is not collecting child results promptly or cannot do so.
A zombie is not a second, idle copy of the program. A sleeping task is still alive and can become runnable when its timer expires or an awaited event happens. A stopped task is alive too and can usually be resumed. A zombie has already terminated and is waiting only for its parent to collect the result.
Clear it by reaping the child
Sending a termination signal to a zombie cannot make it exit a second time. The parent must call wait() or an equivalent operation. In software you control, arrange to collect every child's status, including when a child exits after an error. Libraries and event loops often provide child-process callbacks or nonblocking wait operations.
If the parent exits, the child is reparented to a suitable process, often the init process in that PID namespace or a configured child subreaper. That process can collect the status. Killing an unrelated parent is not a general cleanup method because it also stops the parent's other work.
One short-lived zombie is usually harmless. Many persistent zombies can use up process-table entries. Inspect the parent and how it collects child results to understand why the records remain.







