Linux.com

Answers
  • Zombie process is a process state when the child dies before the parent process.
    In this case the structural information of the process is still in the process table

    Answered by kunal
    5 years ago
    0 0
  • Having a zombie process listed in your ps output is not a bad thing, necessarily. It's usually being kept around in the process table because the parent process may still need to read the exit status of the child process (zombied / defunct process). If it really bothers you, you can try to kill -9 the process. If that doesn make it go away, you can try to nudge the parent proicess by sending it a kill -HUP. To find the parent process:

    ps axo ppid,stat | grep Z | awk '{print $1}' | xargs kill -HUP

    or something similar if you like.

    Answered by gomer
    5 years ago
    0 0
  • Kunal and adam are spot on.

    I just wanted to add that if you're looking for more information on the topic and others like it, you might consider picking up Linux System Programming published by Orielly. It gives an interesting in-depth view of linux, some great examples, and is useful to sysadmins as well as kernel hackers ( myself being a sysadmin with little C expertise ).

    mm~

    Answered by eternalelegy
    5 years ago
    0 0
  • If you're a little bit familiar with C and UNIX programming environment, the following example might help you to understand what is a zombie process.


    #include <unistd.h>
    #include <stdlib.h>
    #include <stdio.h>

    int main() {
        int pid;

         /* let's create a child process */
        pid = fork();
        if (!pid) {
             /* this is a child: dies immediately and becomes zombie */
            exit(0);
        }

         /* parent process: just asks for the user input */
         printf("Please, press enter after looking at the zombie process...");
         (void)getchar();
    }

    After compiling this program (gcc -o zombie zombie.c) and running it (./zombie), don't hurry to press enter. Run in the other terminal:

    $ ps aux | grep Z

    and you will see your zombie process!

    It happens because child process dies and parent does not react on this event properly. Conventionally, parent must call waitpid or wait function to obtain child's exit status. At this moment zombie disappears. However, some programs either forget to call waitpid, either do it some time later.

    HTH,
    Vasily

    Answered by vass
    5 years ago
    0 0
Please register/login to answer this question. Click here to login
Similar Questions Found
Questions from category High Performance

Upcoming Linux Foundation Courses

  1. LFS426 Linux Performance Tuning
    08 Sep » 11 Sep - New York
    Details
  2. LFS520 OpenStack Cloud Architecture and Deployment
    08 Sep » 11 Sep - Virtual
    Details
  3. LFD320 Linux Kernel Internals and Debugging
    15 Sep » 19 Sep - Virtual
    Details

View All Upcoming Courses

Community Answers - Search


Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board