Zombie is a process state where process does not actually exist. It mostly happen when child dies But when
Check the following program
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
int main ()
{
pid_t child_pid;
child_pid = fork ();
if (child_pid > 0) { // Parent Process
sleep (60);
}
else {
exit (0); // Child Process
}
return 0;
}
When you run the above program and see the process details after 2-3 second (ps -e -o pid,ppid,stat,cmd) you will see the child process is marked as and its status code is Z, for zombie. Whenever parent process completes the processing and exit then zombie state for the non-existing child process gets cleared automatically.