what is difference between zombie process and orphan process? explain each with examples in details.

what is difference between zombie process and orphan process

orphan process

A process is know as orphan process when its parent process do not live. It means if a parent process gets terminated without waiting for its child to be finished the child becomes orphan process. Let us see below example.

In the above example the child process is live for 30 seconds while parent process is terminating without waiting for child process to be finished. In this case the child process would be an orphan process. All the orphan process is adopted by linux init process. The Linux init process pid is 1.

Zombie process

A process is a zombie process if the child process finishes before the parent process calls wait,the child process becomes a zombie. Let see below example.

How to avoid zombie process to be created?

we know that without wait() system call, the child process will become a zombie process after its termination because its parent process does not cleanup its process information in the system. There is a blog post at http://thinkiii.blogspot.in/2009/12/double-fork-to-avoid-zombie-process.html which usesĀ  double fork to prevent zombie process.




Related Contents to follow