PID re-use,边缘情况?

PID re-use, edge case?

我读到 PID 重用是在进程为僵尸并被等待时完成的。

如果我 fork 了数百个进程并且不等待它们就杀死了 parent 会发生什么?我知道他们将是 init 进程的 children,但谁会等待他们呢? (否则我们会遇到麻烦并受 PID 限制)。

I know they will be children of init process but who will call wait on them?

init(PID 为 1 的进程)将获取其所有子进程,包括 adpoted 僵尸进程。正如它在 https://en.wikipedia.org/wiki/Zombie_process

上所说

init periodically executes the wait system call to reap any zombies with init as parent.