How does the parent know the termination of child process? What action does the parent process take when the child process gets terminated?
Answers
Answered by
2
Exit status of a child process in Linux
It is known that fork() system call is used to create a new process which becomes child of the caller process.
Upon exit, the child leaves an exit status that should be returned to the parent. So, when the child finishes it becomes a zombie.
Whenever the child exits or stops, the parent is sent a SIGCHLD signal.
The parent can use the system call wait() or waitpid() along with the macros WIFEXITED and WEXITSTATUS with it to learn about the status of its stopped child.
Similar questions