Sobes.tech
Middle

What is the difference between a orphan process and a zombie process?

sobes.tech AI

Answer from AI

An orphan process is a process whose parent process has finished execution before the child process has completed. The init process (PID 1) automatically adopts the orphan and becomes its new parent for subsequent resource cleanup.

A zombie process is a process that has finished execution but its entry in the kernel process table (PCB) has not yet been removed because the parent process has not called the wait() or waitpid() system call to collect the child's termination status. Such a process does not consume CPU resources but occupies a slot in the process table.

Comparison:

Attribute Orphan Process Zombie Process
State Running (or waiting to run) Terminated
Parent Original parent has finished, new parent is init (PID 1). Parent exists but has not called wait().
CPU Resources Consumes CPU resources to perform its task. Does not consume CPU resources.
Table Space Occupies space in the process table as a normal running process. Occupies space in the process table until its status is read by the parent.
Removal Will be terminated and cleaned up by the OS after completion. Remains in the process table until the parent calls wait() or terminates (in which case it becomes an orphan init and will be cleaned up).