我正在阅读一本关于父/子过程的教科书,作者说:
If a parent process terminates without reaping its zombie children, then the kernel arranges for the init process to reap them. However, long-running programs such as shells or servers should always reap their zombie children. Even though zombies are not running, they still consume system memory resources.
但是根据这个问题的回答What does reaping children imply?
似乎大部分/所有僵尸的资源都被释放了,只有一个资源肯定还在消耗是那个进程表槽。 process table slot我不熟悉,但我认为它存储了僵尸的退出状态。
无论如何,进程表槽中的一条记录听起来没什么大不了的,可能只消耗几个字节/kb 的内存,所以为什么长时间运行的程序应该总是通过调用 等等
变体?
最佳答案
进程数有上限,最低可达32768。
出于此目的,僵尸进程仍算作进程。
如果您创建了数千个僵尸进程并且不回收它们,系统将无法创建更多进程。这很糟糕。
关于c - 为什么长时间运行的程序总是要收割它们的僵尸 child ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63792927/