Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Write a program in which the child process waits for parent process to complete some actions. The detailed actions are as follows (refer the

image text in transcribed

image text in transcribed

1. Write a program in which the child process waits for parent process to complete some actions. The detailed actions are as follows (refer the procexec/fork_sig_sync.c which has reverse roles) : 40 points FILE NAME: hw5_1.c - Before fork: a. Use SIGUSR1 and add this signal to the signal mask b. Use signal( ) to call signal_handler( ) that prints out Here is the Signal Handler - Child process c. Suspend child process waiting for a signal from the parent d. Prints out Child received a signal e. Restore signal mask from the backup list f. Exit - Parent process g. Print out Parent started h. Sleep 3 seconds i. Print out Parent about to signal child j. Send the SIGUSR1 to the child k. Exit 2. Write a program that reaps dead children via a handler for SIGCHLD as follows (Refer procexec/multi_SIGCHLD.c) : 40 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( ) loop - Child Process e. Sleep as given by the inputs f. Print out child PID - Parent Process g. Send a signal, SIGKILL to each child process to kill by using kill( ) - After fork: h. Wait for SIGCHLD until all children are dead

Write a program in which the child process waits for parent process to complete some actions. The detailed actions are as follows (refer the "procexec/fork_sig_sync.c" which has reverse roles) : 40 points 1. FILE NAME: hw5 1.c -Before fork: Use SIGUSR1 and add this signal to the signal mask b. a. Use "signal()" to call "signal-handler()" that prints out Here is the Signal Handler" Child process c. Suspend child process waiting for a signal from the parent d. Prints out "Child received a signal" e. Restore signal mask from the backup list f Exit Parent process g. Print out "Parent started h. Sleep 3 seconds i. Print out "Parent about to signal child... j. Send the SIGUSR1 to the child k. 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_2

Step: 3

blur-text-image_3

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

Relational Database And Transact SQL

Authors: Lucy Scott

1st Edition

1974679985, 978-1974679980

More Books

Students also viewed these Databases questions

Question

5. What information would the team members need?

Answered: 1 week ago

Question

Which team solution is more likely to be pursued and why?

Answered: 1 week ago