Sample Header Ad - 728x90

zombie process reap without "wait"

4 votes
2 answers
1535 views
I know if a subprocess does not get reaped properly, it will become a zombie and you can see it by ps command. Also the "wait [pid]" command will wait for subshell running on the background until it finishes and reap it. I have a script like this:
#!/bin/bash
sleep 5 &

tail -f /dev/null
My question is, I don't use wait after sleep 5 & and the parent shell will never terminate because of tail, then why the sleep 5 & will not become a zombie? I see it disappear after finishing in ps, not sure who reaps it?
Asked by chengdol (303 rep)
Apr 11, 2021, 06:58 AM
Last activity: Apr 11, 2021, 09:42 PM