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
|
An orphan is still executing, a zombie just wont die
|
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.
|
Quote:
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 |
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. |
Quote:
That was crystal clear ! |
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 |
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. |