Find the answer to your Linux question:
Results 1 to 3 of 3
1)Using fork() to generate child process in TestC. user_ubuntu:~$ ps -al F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD 0 S 1000 24815 24795 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2009
    Posts
    2

    Zombie Process?


    1)Using fork() to generate child process in TestC.

    user_ubuntu:~$ ps -al
    F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
    0 S 1000 24815 24795 0 80 0 - 612 select pts/2 00:00:00 top
    0 S 1000 24990 24954 0 80 0 - 707 tty_wr pts/1 00:00:00 TestC
    1 S 1000 24991 24990 0 80 0 - 707 n_tty_ pts/1 00:00:00 TestC
    0 R 1000 25012 24994 0 80 0 - 635 - pts/3 00:00:00 ps
    user_ubuntu:~$ kill -9 24990 2)kill the parent with kill -9 parentPID
    user_ubuntu:~$ ps -al
    F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
    0 S 1000 24815 24795 0 80 0 - 612 select pts/2 00:00:01 top
    1 S 1000 24991 1 1 80 0 - 707 n_tty_ pts/1 00:00:01 TestC
    0 R 1000 25017 24994 0 80 0 - 635 - pts/3 00:00:00 ps
    user_ubuntu:~$
    3) Child process's PID is 1.

    I think I got a zombie process now. but it's not true from the output of "top" command. Why?

    platform_obuntu.

  2. #2
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,252
    You do not have a zombie process. Instead, you have an orphan process.

    A process becomes a zombie once it finishes execution, but its parent never checks its status via the wait() system call (or, more likely, a waitpid() call). The process is a zombie because its status must be remembered (so that the parent can check on it) even though the process has finished.

    An orphan process, on the other hand, is a process whose parent has died. In this case, the process's parent becomes the init process (PID 1). All daemon processes are orphans. init will automatically check the statuses of its children, and as far as I know, an orphaned process cannot become a zombie.

    Looking at your ps output, we see that 'Z' is not given to indicate that your child process is a zombie, but the child's parent ID (the PPID) is 1, which is init's PID. Therefore, you have an orphan.

  3. #3
    Linux Newbie
    Join Date
    Jan 2008
    Location
    Canada
    Posts
    109
    Hi useyy
    Zombie processes do not use resources. The entry in the Process Table remains but all resources are returned to the pool.
    The child has not been removed but it is dead. The resource overhead is minimal. Zombies can actually be desirable on occasion to nesure that when a parent opens several children that no two ever get the same PID.
    Hope this helps. Cheers...
    Robert

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •