Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Make a fork tree diagram and explain. int pid = 0; void sigchild(int s) { printf(wow); fflush(stdout); if (pid) { kill(pid, SIGHUP); } } void

Make a fork tree diagram and explain. int pid = 0; void sigchild(int s) { printf("wow"); fflush(stdout); if (pid) { kill(pid, SIGHUP); } } void sighup(int s) { printf("get"); fflush(stdout); if (!pid) { kill(getppid(), SIGHUP); } } int main() { int status; pid_t p; Signal(SIGCHLD, sigchild); Signal(SIGHUP, sighup); int i; for (i = 0; i <= 2; i++) { if ((pid = fork()) == 0) { kill(getppid(), SIGHUP); // getppid returns parents pid sleep(1); exit(0); } sleep(1); } if ((p = wait(&status)) > 0) { fprintf(stderr, "low"); } else { fprintf(stderr, "high"); } fflush(stdout); return 0; } 

In this program, a parent process (P) forks child processes C1, C2, and C3.

Can C1 print "get"?

_____________(Y/N)

Can C2 print "get"?

____________(Y/N)

What is the maximum number of times P might print "get"?

__________(number require)

What is the maximum number of times C3 might print "get"?

___________(number require)

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

More Books

Students also viewed these Databases questions

Question

Discuss the process involved in selection.

Answered: 1 week ago

Question

Differentiate tan(7x+9x-2.5)

Answered: 1 week ago

Question

Explain the sources of recruitment.

Answered: 1 week ago

Question

Differentiate sin(5x+2)

Answered: 1 week ago

Question

Compute the derivative f(x)=1/ax+bx

Answered: 1 week ago

Question

Question What is the advantage of a voluntary DBO plan?

Answered: 1 week ago

Question

Question How is life insurance used in a DBO plan?

Answered: 1 week ago