Middle+
What are the statuses of a process in Linux? What is a zombie process?
sobes.tech AI
Answer from AI
In Linux, a process can be in several states, the main ones are:
- R (Running) — the process is executing or ready to execute;
- S (Sleeping) — the process is waiting for an event or resource (sleeping);
- D (Uninterruptible sleep) — the process is in a sleep state that cannot be interrupted (usually waiting for I/O);
- Z (Zombie) — the process has finished, but its parent has not yet read the exit status;
- T (Stopped) — the process is stopped (for example, by SIGSTOP signal);
- I (Idle) — the process is inactive (in some systems).
A zombie process is a process that has completed execution, but its parent process has not yet called wait() or an equivalent function to retrieve its exit status. As a result, the process record remains in the process table, occupying resources. Zombie processes do not use CPU, but they can accumulate and lead to exhaustion of process limits.
Example: if the parent does not handle SIGCHLD and does not call wait(), child processes become zombies after termination.