Junior — Middle
Explain what zombie processes are in the Linux operating system and what their essence is.
sobes.tech AI
Answer from AI
Zombie processes in Linux are processes that have finished execution but have not yet been completely removed from the operating system's process table. They remain in a "defunct" state because their parent process has not yet read their exit status via the wait() system call.
The essence of a zombie process:
- The process has finished, freed resources, but its entry in the process table remains.
- This is necessary for the parent to obtain the return code and other information about the termination.
- If the parent does not call
wait(), the zombie will linger, occupying space in the process table.
If there are many such processes, it can lead to resource exhaustion.
To prevent zombies, the parent must properly handle the termination of child processes by calling wait() or setting up a SIGCHLD signal handler.