What is the difference between orphan and zombie process




















On Unix and Linux operating systems, a zombie process or defunct process is a process that has completed execution via the exit system call but still has an entry in the process table. It is a process in the " Terminated state ". A child process always first becomes a zombie before being removed from the process table. Zombie process cause a resource leak Only the resource required to maintain a process in the process table. Unlike normal processes, the kill command has no effect on a zombie process.

Zombie processes can be identified in the output from the Unix ps command by the presence of a " Z " in the " STAT " column ps command. Zombies that exist for more than a short period of time typically indicate a bug in the parent program, or just an uncommon decision to not reap the children. If the parent program is no longer running, zombie processes typically indicate a bug in the operating system. As with other resource leaks, the presence of a few zombies is not worrisome in itself, but may indicate a problem that would grow serious under heavier loads.

Since there is no memory allocated to zombie processes, the only system memory usage is for the process table entry itself. The primary concern with many zombies is not running out of memory, but rather running out of process table entries, concretely process ID numbers.

Save Article. Improve Article. Like Article. Last Updated : 08 Oct, Zombie process state. Attention reader! Recommended Articles. Article Contributed By :. Easy Normal Medium Hard Expert. Writing code in comment? This can happen when the parent process terminates due to some reasons before the completion of the child. An orphan process gets a new parent. The kernel detects that a process has become orphan and tries to provide a new parent to the orphan process.

The new parent waits for the completion of the child orphan process and then asks the kernel to clean the PCB of the orphan process. So, all child processes will become zombie after they terminate. Now, what happens to these zombie processes when the parent process terminates?

Zombie processes then also becomes an orphan process. Their PCB still exists in the main memory and they also do not have a parent. These zombie process turned orphan process will then get reparented. The new parent will then collect their status and ask the kernel to clean their PCB.



0コメント

  • 1000 / 1000