Skip to main content
If ps shows a process with status defunct, that entry is a zombie process. Example:
The defunct (or Z) state means the process has already exited — it’s dead — but its minimal bookkeeping entry (exit status, PID, and resource accounting) remains in the kernel process table because the parent has not yet collected that information. How this works
  • When a process exits, the kernel keeps the child’s exit status and basic accounting until the parent calls a wait-family syscall (wait(), waitpid(), etc.). The parent retrieving the child’s status is called reaping.
  • A zombie is an exited child that has not been reaped. It uses no CPU and almost no memory — just a tiny process table entry.
  • Because the process is already dead, sending signals (including kill -9) has no effect.
An infographic explaining zombie processes: a child process has exited but remains listed because the parent didn't call wait(), shown as STATUS "Z" in a process table and illustrated with a ghost labeled "This is the zombie."
Diagnosing zombies
  • Find the parent PID (PPID) and inspect the parent process to see why it’s not reaping children.
  • Useful command:
If the parent is buggy (for example, it never calls wait()), it will accumulate zombies. If that parent process exits, the kernel reparents those entries to PID 1 (init/systemd). PID 1 will reap children when they exit, clearing the zombie entries.
A dark-themed slide explaining that "kill-9 does nothing" and advising to "Fix the parent," with colored boxes showing a parent process calling wait(), the parent dying, and PID 1 (init/systemd) reaping the child automatically. The diagram highlights that signals are for live processes and shows the practical flow.
Orphan processes
  • An orphan is a live child whose parent died earlier. The kernel immediately reparents that live child to PID 1, which will wait on it when it exits.
  • Orphans continue running normally; they are not zombies.
A black-background diagram titled "The Orphan" showing a crossed-out parent process, a surviving child process, and an arrow to a box labeled "PID 1 adopts it." The caption explains PID 1 will wait on the child when it exits.
Quick comparison When zombies matter
  • A few zombies are usually harmless. The kernel holds only tiny bookkeeping.
  • A large accumulation of zombies can exhaust the PID namespace and indicate a buggy parent process that never reaps children.
  • In container environments, the main application often runs as PID 1. If that program does not reap child processes, zombies can build up inside the container.
Containers and reaping
  • For containers, use a tiny init (like tini) as PID 1 to correctly reap children. Docker provides a convenience flag to run an init process:
Summary
  • Zombie: process has exited but remains listed until its parent reaps it.
  • Orphan: process is still running after its parent dies; PID 1 adopts it.
  • Fix the parent (or restart it) to clear zombies; in containers, run an init as PID 1 if your app doesn’t reap children.
If you need to debug zombies, find the PPID of the defunct process (ps -o pid,ppid,stat,cmd -p <PID>) and inspect or fix the parent. If the parent can’t be fixed immediately, restarting or killing it will cause PID 1 to adopt and reap the exited children.
Links and references

Watch Video