How to Identify a Zombie Process Linux

In many interviews related to Linux, the interviewers usually ask about what is a zombie process in Linux, and most people mix it with Orphan Process?

In reality, both the terms are completely different from each other. A zombie process is something similar to the zombies that you see in the horror movies.

Like zombies who do not have any life left in them, a zombie process is a dead process which remains in the process table of Linux even after the main process is closed. Technically, a zombie process is one which has released all the resources after its execution, but the entry of the process still remains in the process table.


  • 1

    How Zombie process is created

    Usually, bad coding is the main reason behind the creation of a Zombie process in Linux. Normally, after a sub-process, which is also known as child process, completes its task and exits. At that time, the parent process give a “wait” call to the child process and checks its status. It is usually a very small duration.

    Therefore, if the parent process, due to any reason such as bug or bad coding, does not check the exit status of the child process, it turns into a zombie process, and remains in the process table of Linux.

  • 2

    How to find the Zombie process in Linux

    If you feel that there are some Zombie processes running on your computer, then you can run the Linux command line utility “top”. After you run the command, you will get a list of the Zombie processes at the right top corner of the output.

    You can also use the “# ps aux” command, without the quotes to check all the processes running on your computer. The processes with “z” written in their respective Stats columns will be Zombie processes.

  • 3

    How to kill a Zombie process in Linux

    Before you take any step to kill the Zombie process that you just identified, you should wait for some time, as the parent process sometimes leave the child process in zombie state, in order to wait for the future child processes and assign them new PIDs. Sometimes, it also happens that the parent process gets occupied and it takes some time to get the status of the child processes.

    If the zombie process still remains in the process table, then you can send the SIGCHLD signal to parent process, and it will delete its child process immediately. In order to give the SIGCHLD signal, enter “# kill -s SIGCHLD
    ” without the quotes.

Leave a Reply

Your email address will not be published. Required fields are marked *

four + = 10