Why a Finished Program Can Still Appear in the Process List
On Unix-like systems, a running program is represented by a process: a kernel-managed record that tracks things such as its process ID, or PID, and its relationship to other processes. When a program finishes, the operating system can release its working memory and other resources immediately. But it keeps a small record until the program’s parent collects the child’s exit status.
That collection is done with a system call commonly known as `wait`. The status tells the parent how the child ended—for example, whether it finished normally or encountered an error. Keeping the record briefly lets the parent retrieve that information even if the child has already stopped running.
The Parent Has to Reap the Child
A process in this waiting state is called a zombie. The name sounds more dramatic than the reality: a zombie cannot execute instructions, consume CPU time, or keep using the memory it had while running. It is simply an entry in the process table, the kernel’s list of processes and their states.
Normally, the parent calls `wait` and the kernel removes that entry. If the parent fails to do so, the zombie remains until the parent eventually collects its status or exits. When a parent exits first, the child is adopted by a system process or another designated process, which can collect the status and clear the record.
Why It Matters
One zombie is usually a brief administrative delay, not a program secretly running in the background. A large number can indicate that a parent program is not handling its finished children properly. Each zombie occupies a process-table entry and retains a PID until it is cleared; enough lingering entries can leave the system with fewer slots for new processes. The useful fix is generally to address the parent’s cleanup behavior, not to try to terminate a child that has already stopped.





