LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   diffrence between zombie and orphan process (https://www.linuxquestions.org/questions/linux-newbie-8/diffrence-between-zombie-and-orphan-process-794531/)

rockingb4u 03-10-2010 04:35 PM

diffrence between zombie and orphan process
 
i am bit confused about the two process that is zombie and orphan procees,both is different so what is the exact difference between the two process that makes it different and if there is no parent process then init adopts the children in both the case.so please make me clear

jamescondron 03-10-2010 04:38 PM

An orphan is still executing, a zombie just wont die

penguiniator 03-10-2010 05:36 PM

http://en.wikipedia.org/wiki/Orphan_process has a short explanation with a link to a similar entry for zombie processes. Their names are quite descriptive.

Aquarius_Girl 03-10-2010 10:25 PM

Quote:

Originally Posted by rockingb4u
i am bit confused about the two process that is zombie and orphan procees,both is different so what is the exact difference between the two process that makes it different and if there is no parent process then init adopts the children in both the case.so please make me clear

If the child process is dead but its parent process is alive, the child process is declared zombie, means if you run ps aux, you will see that the just died child process is having a Z in the STAT column.

If parent process is dead but its child process is alive, the child process is declared orphan, means it is now adopted by its new parent .. the init process.


Nice link for more clarification:
http://bloggerdigest.blogspot.com/20...n-process.html

sundialsvcs 03-10-2010 10:57 PM

Here's a good way to think of it...

Zombie: Processes routinely do things by "spawning" child processes and waiting for those child processes to complete. But here's the rub: "Okay, now that the child process has finished executing, how do I get its ending status? If the process is now 'dead and gone,' how do I know what happened to it?"

The solution is: "it becomes a zombie." In other words, the child process is dead, but it is not quite yet gone. It won't disappear until the parent process collects its status. (And the entire reason for the "zombie" status is literally so that it is possible for the parent process to do that.)

---

Orphan: If a parent process dies, but its children have not, then those children are, literally, now "orphans." Linux has to put them somewhere, and what it does is to attach them temporarily as children of "process #1, init," which by definition cannot die. This makes it possible for them to be properly cleaned-up without creating a bunch of weird and messy special cases in the kernel's handling of processes.

Aquarius_Girl 03-10-2010 11:02 PM

Quote:

Originally Posted by sundialsvcs
Zombie: Processes routinely do things by "spawning" child processes and waiting for those child processes to complete. But here's the rub: "Okay, now that the child process has finished executing, how do I get its ending status? If the process is now 'dead and gone,' how do I know what happened to it?"

The solution is: "it becomes a zombie." In other words, the child process is dead, but it is not quite yet gone. It won't disappear until the parent process collects its status. (And the entire reason for the "zombie" status is literally so that it is possible for the parent process to do that.)

Thanks,
That was crystal clear !

kmehindru4 12-27-2013 11:28 AM

ZOMBIE vs ORPHAN process
 
A zombie is a process when child process completes execution before parent but is not terminated & then child process will be in zombies state where it will not use any resources and show its status as Z+ (Zombie) ,only parent can terminate the child by receiving a exit code .
In orphan process parent finishes execution before child & as to terminate child parent is needed ,which is absent now so child will be allocated a new parent i.e. init ,
any process whose parent is non existing is adopted by the init process whose pid is 1

haertig 12-27-2013 08:47 PM

To put it in rather graphic terms, parents must reap their dead children, lest they become zombies.


All times are GMT -5. The time now is 02:12 PM.