What is a zombie process, and how do you get rid of it?
IntermediateConceptProcesses, Signals & systemd
Answer
A zombie (Z state, <defunct>) has exited but its parent has not called wait() to read its exit status. It uses no CPU or memory, only a PID table slot. You cannot kill a zombie; you fix or kill the parent, after which init adopts and reaps it.
ps -eo pid,ppid,stat,cmd | awk '$3 ~ /Z/'
Thousands of zombies can exhaust pid_max.
More on Processes, Signals & systemd
What is the difference between a program, a process and a thread?BeginnerHow are new processes created in Linux?IntermediateWhat is an orphan process?BeginnerExplain the process states shown in ps (R, S, D, T, Z).IntermediateWhy can't you kill a process in D state?AdvancedWhat are signals? Name the important ones.Beginner