Interview Q&A / Linux & Shell

IntermediateQuick answer1 min readUpdated 3 Oct 2026

What is a zombie process, and how do you get rid of it?

SHORT ANSWER

A zombie is a process that has finished but still has an entry in the process table because its parent has not read its exit status. It uses no CPU or memory beyond that entry. You fix it by making the parent call wait, restarting the parent, or killing the parent so init adopts and cleans it.

Explain it simply

Think of a student who has finished the exam and left, but whose name is still on the attendance register because the invigilator has not ticked it off. That name on the register is a zombie.

When a process exits, the kernel keeps a small record (PID and exit code) until its parent collects it with wait(). Until then the process shows as state Z in ps, with <defunct> next to the name.

A few zombies are normal and vanish quickly. Many of them point to a buggy parent that never reaps its children. They hold no memory or CPU, but they use up PIDs, and in extreme cases the PID limit.

You cannot kill a zombie with kill -9 because it is already dead. Options: send SIGCHLD to the parent (kill -s SIGCHLD PPID), fix or restart the parent, or kill the parent so that PID 1 adopts the zombies and reaps them.

Example

bash
ps -eo pid,ppid,stat,cmd | awk '$3 ~ /^Z/'
#  5120  5100 Z   [worker] <defunct>
kill -s SIGCHLD 5100      # ask the parent to reap

What to say in the interview

"A zombie has exited but its parent has not collected the exit status. It consumes no resources beyond a process table slot. I find the parent with ps, ask it to reap or restart it, because kill -9 on a zombie does nothing."

Common mistakes

  • Trying kill -9 on the zombie itself.

#linux#processes#zombie

Related questions

Practise more Linux & Shell questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open Linux & Shell quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.