Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you please help with C-Linux program for the below request: Handling multiple signals from the child : For this exercise we will be writing

Can you please help with C-Linux program for the below request:

Handling multiple signals from the child :

For this exercise we will be writing a program that creates a child process; as to be expected the parent and the child perform different tasks. Here is the parent's behavior: signals to handle: SIGCHLD -- the parent should use wait or waitpid to clean up after the children that have just terminated. If no children remain, the parent should print a message indicating this and terminate. SIGINT -- the parent should handle SIGINT print the message "Exit: Are you sure (Y/n)?" and handle accordingly. Exits the parent if the user enter's 'Y', otherwise don't. SIGUSR1 -- the parent should print the message "The child has generated X values less than 25" and then return to its pause state. SIGUSR2 -- the parent should print the message "The child has generated Y values greater than 75" and then return to its pause state. behavior in function main: the program should setup all signal handlers, spawn the child, and enter a pause loop; feel free to print messages along the way indicating everything you are doing. You might want to set up an exit handler that sends a SIGTERM to any children that are still running; by default, the SIGINT from ctrl-c should be sent to the parent and it's children. Here is the child's behavior: signals to handle: SIGINT -- if your intention is to pause the child while handling SIGINT in the parent, you will likely need to ignore SIGINT in the child. SIGTERM -- informs the child that its parent has died and needs to terminate itself none or SIGALRM (depends on the method you chose below) behavior in function main: the child should generate a random number every 15 seconds. This can be handled with an interval timer or with nanosleep. In either case, the child should generate a random number between 0 and 100. if that number is less than 25, the child should generate SIGUSR1 and send it to the parent;

if that number is greater than 75, the child should generate SIGUSR2 and send it to the parent; if that number is between 48 and 51, the child should exit

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 12c SQL

Authors: Joan Casteel

3rd edition

1305251032, 978-1305251038

More Books

Students also viewed these Databases questions

Question

What impact (if any) does missing data have on the ratios?

Answered: 1 week ago