in reply to How the parent process knows that all its child process has finished execution?

The parent process could store all PIDs of its children, and every time a child terminates, it would remove the respective PID from that set in the SIGCHLD handler (waitpid returns the PID of the deceased process). When the set is empty, all immediately forked processes are gone.

  • Comment on Re: How the parent process knows that all its child process has finished execution?
  • Download Code