1

I'm a beginner in Operating Systems and Linux, just a question on zombie processes.

I don't understand why parent processes need to reap child processes? Can't Linux just be designed to behave like: whenever a child process is terminated, it is going to be reaped automatically immediately without waiting for its parent process, which can save programers' time? Another question is, why a zombie process still consume system memory resources, isn't that it is already terminated, nothing needs to be maintained?

  • Possible duplicate of [Zombie processes](https://stackoverflow.com/questions/3857575/zombie-processes) – Tsyvarev Mar 20 '19 at 08:56
  • Generally you want to know *why* the process exited so you can handle errors appropriately. – Shawn Mar 20 '19 at 09:21
  • Going off of what the other two people said above, the state of the zombie process is kept until the process is reaped. The state contains the exit code (and other information as well) which the parent process may want to know. If the zombie process were reaped automatically, then the parent may not have a chance to read the exit code before the zombie process state is freed. – Jack Humphries Mar 20 '19 at 10:27
  • Another reason is deamon-ized processes where you don't want to reap an orphan process. – Alex Jun 02 '22 at 23:33

0 Answers0