Reputation: 47
I read that PID reuse is done when process is zombie and was waited for.
What happens if I forked hundreds of processes and just killed the parent without waiting for them? I know they will be children of init process but who will call wait on them? (else we are in trouble and limited with PIDs).
Upvotes: 0
Views: 105
Reputation: 12528
I know they will be children of init process but who will call wait on them?
init
(process with PID 1) will reap all of its child processes, including adpoted zombie processes. As it says on https://en.wikipedia.org/wiki/Zombie_process
init periodically executes the wait system call to reap any zombies with init as parent.
Upvotes: 3