I am reading book The Linux Programming Interface, I see the following 2 paragraphs about zombie process sort of conflicting:
When the parent does perform a wait(), the kernel removes the zombie, since the last remaining information about the child is no longer required. On the other hand, if the parent terminates without doing a wait(), then the init process adopts the child and automatically performs a wait(), thus removing the zombie process from the system.
If a parent creates a child, but fails to perform a wait(), then an entry for the zombie child will be maintained indefinitely in the kernel’s process table. If a large number of such zombie children are created, they will eventually fill the kernel process table, preventing the creation of new processes.
The first paragraph says, even the parent process did not call wait() and terminated the long running child process, init would pick the zombie process and clear the child process off upon its termination.
The following paragraph says, if the parent process does not call wait(), then its long running child processes will become zombie and occupy kernel process table forever.
I am confused - how can the situation of 2nd paragraph happens if init takes care of picking up zombie process? Or in what situation will init miss picking up zombie?
[Update] Yes, I misread the text, thanks Barmar, these 2 paragraphs talk about different scenarios.