Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include int ntimes = 0; main() { pid_t pid, ppid; void p_action(int), c_action(int); static struct sigaction pact, cact; pact.sa_handler = (a) _______; sigaction((b) _______, &pact,

#include

int ntimes = 0;

main()

{

pid_t pid, ppid;

void p_action(int), c_action(int);

static struct sigaction pact, cact;

pact.sa_handler = (a) _______;

sigaction((b) _______, &pact, NULL);

switch(pid = fork()) {

case -1: /* error */

perror("synchro");

exit(l);

case 0: /* child */

/* set action for child */

cact.sa_handler = (c)_______;

sigaction((d)______, &cact, NULL);

/* get parent process-id */

ppid = getppid();

for (;;)

{

(e)________ ;

sleep(1);

(f)________;

}

/* never exits */

default: /*parent */

for(;;)

{

sleep(1);

(g)__________;

(h)_________;

}

/* never exits */

}

}

void p_action(int sig)

{

printf("Parent caught signal #%d ", ++ntimes);

}

void c_action(int sig)

(

printf("Child caught signal #%d ", ++ntimes);

}

image text in transcribed
do this entire problem with working code and you will get your thumbs up. just give me the fill in of a-h
Complete the attached template program with the following process synchronization behavior. This synchronization process continues forever. Note that SIGUSR2 is used from Parent to Child process, and SIGUSR1 is used from Child to Parent process. The order of signal generations are noted as numbers in the above diagram, (1) and (2). The output from your program should be: Child caught signal\# 1 Parent caught signal\# 1 Child caught signal\# 2 Parent caught signal\# 2 Child caught signal\# 3 Parent caught signal\# 3 Enter the missing fields, (a) through (h), into the Blackboard "Final Exam Submission." You may refer to the example program "synchro.c" in page 144-145 in the textbook, which is implementing a slightly different synchronization behavior. /* synchro */ \#include h>

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

Expert Oracle9i Database Administration

Authors: Sam R. Alapati

1st Edition

1590590228, 978-1590590225

More Books

Students also viewed these Databases questions

Question

signed binary number in the a. 10011001 b. 01110100

Answered: 1 week ago

Question

Does your message use defamatory language?

Answered: 1 week ago