In an operating system, various processes continuously run to perform the user's tasks. Zombie and orphan processes are two of the various different process types running in an operating system. These processes are a product of interrelated parent and child processes.
Note: Learn more about the zombie and orphan processes in the Answers below:
In this Answer, we will discuss how these processes are formed and their differences.
To understand the differences between these two system processes, we will start with an illustration of how these two processes are formed.
The diagram shows that a parent has two children, Child 1 and Child 2. The parent process is not made to wait for either of the child processes.
When Child 1 terminates, we see that the parent process was asleep, so it did not collect the exit status of the child process, and the process became a zombie. So a process whose parent fails to collect its exit status upon termination becomes a zombie.
When Child 2 terminates, we see that its parent had already terminated before, so it became an orphan process, as the name states. This shows that if a process's parent terminated before the process, that process becomes an orphan.
Now that we have discussed what an orphan and a zombie process are and how they are both formed, we will discuss their key differences below.
Process status: A zombie process refers to a process that has completed its execution and waiting for its parent to collect its exit status, whereas an orphan process is still in its execution phase even after its parent terminates.
Parent status: The
System impact: As zombie processes are not in the running phase, they do not use up many system resources, whereas an orphan process continues to consume system resources as they are still running.
Process handling: The parent process handles a zombie process, whereas the init process handles the orphan process after its parent is terminated.
In conclusion, the zombie and orphan processes states are two of the various process states in an operating system. Although these processes are not harmful, they still occupy system resources and display the need for proper parent-child process interaction.
A good operating system should always implement the best practices for dealing with these types of processes by ensuring the parent process removes its zombie children and help in finding orphan processes a loving parent.
Free Resources