Question: 6) Consider the following code and answer the following questions. #include #include #include int x, y; void cal(); int main() { int pid; int x=1;

 6) Consider the following code and answer the following questions. #include

6) Consider the following code and answer the following questions. #include #include #include int x, y; void cal(); int main() { int pid; int x=1; int y=2; pid (int) fork(); /* create a process */ == if (pid 0) { x = x + y; y++; printf("(at A) x is %d, y is %d ", X, Y); /* (A) */ return (0); } else if (pid > 0) { wait (NULL); y--; X = x + 10; printf("(at B) x is %d, y is %d ", X, Y); /* (B) */ return (0); } } A) Assume a process will be successfully created. What would be the value of x and y at (A)? Justify your answer. (5 Points) B) Assume a process will be successfully created. What would be the value of x and y at (B)? Justify your answer. (5 Points)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!