Question: using ubuntu/linux 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
using ubuntu/linux

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 sigsuspend() loojp - Child Process Sleep as given by the inputs Print out child PID and current time Exit using _exit(O e. f. g. - 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 12 34 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
Get step-by-step solutions from verified subject matter experts
