Question: The program is for Ubuntu platform, has to be done in C, and build under tlpi-dist/procexec folder, which can be found in here http://man7.org/tlpi/code/download/ under

 The program is for Ubuntu platform, has to be done in

The program is for Ubuntu platform, has to be done in C, and build under tlpi-dist/procexec folder, which can be found in here http://man7.org/tlpi/code/download/ under the name of tlpi-160726-dist.tar.gz

2. Write a program that reaps dead children via a handler for SIGCHLD as follows (Refer procexec/multi _SIGCHLD.c) : 45 points FILE NAME: hw5_2.c Signal Handler for SIGCHLD a. This handler calls wait() to release dead child process ID b. Lengthen execution of handler using sleep() for 3 seconds Before fork) c. Call signal() with the signal handler, signal_Handler) d. Block SIGCHLD to prevent its delivery if a child terminates before the parent commences the siasuspend) loop Child Process e. Sleep as given by the inputs f. Print out child PID and current time g. Exit using _exit0 Parent Process h. Does nothing (i.e., just use break to escape oft of switch if you use it) After fork) i. Replace the process signal mask by the empty signal set j. Suspend the parent process waiting for a SIGCHLD from the until all children are dead The program should be able to create any number of child processes with corresponding waiting time in second(s) such as $./hw5_2 1 2 3 4 5 (5 child processes with waiting times, 1, 2, 3, 4, and 5 seconds) $./hw5_2 1 5 10 2. Write a program that reaps dead children via a handler for SIGCHLD as follows (Refer procexec/multi _SIGCHLD.c) : 45 points FILE NAME: hw5_2.c Signal Handler for SIGCHLD a. This handler calls wait() to release dead child process ID b. Lengthen execution of handler using sleep() for 3 seconds Before fork) c. Call signal() with the signal handler, signal_Handler) d. Block SIGCHLD to prevent its delivery if a child terminates before the parent commences the siasuspend) loop Child Process e. Sleep as given by the inputs f. Print out child PID and current time g. Exit using _exit0 Parent Process h. Does nothing (i.e., just use break to escape oft of switch if you use it) After fork) i. Replace the process signal mask by the empty signal set j. Suspend the parent process waiting for a SIGCHLD from the until all children are dead The program should be able to create any number of child processes with corresponding waiting time in second(s) such as $./hw5_2 1 2 3 4 5 (5 child processes with waiting times, 1, 2, 3, 4, and 5 seconds) $./hw5_2 1 5 10

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!