Question: In this problem you are requested to expand the previous problem so that the processes can be handled via the use of signals, in order

In this problem you are requested to expand the previous problem so that the processes can be handled via the use of signals, in order to print their messages in a depth-first fashion. Every process creates its own children-processes and suspends its execution until it receives the appropriate resume signal (SIGCONT). When the process receives SIGCONT it prints the corresponding message and activates its child processes one after another. It monitors and waits for their terminations and prints the corresponding diagnostics. The process evolves recursively, starting from the root process. The initial process of the program sends SIGCONT to the root process, after displaying the process tree to the user. In the example of scheme 1, the activation messages are printed in order: A, B, D, C Remarks: A process suspends its execution with the use of sys call: raise (SIGSTOP). But before it does so, it validates that all the children have suspended their execution as well. This validation is conducted by means of a function named: wait for_children(). To build the latter you may use function explain_wait_status () following sys call wait) or waitpid(). During your program execution you may try to send manual messages via the use of instruction kill from another window. You may use the command: strace -f -p
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
