Question: 1. (50 pts) Assuming no errors and no cascading termination, trace the following program and answer the following questions: #include 2 include 3 inelude sint


1. (50 pts) Assuming no errors and no cascading termination, trace the following program and answer the following questions: #include 2 include 3 inelude sint main(int arge, char *argv[])! pid ! *-0. y - 1: 9 1 - fork (): 101 - fork(): if (x !- 0) 12 y - fork: // End If 14 if (y > 0) 15 fork) : 16 // End If 17 printf("% dy - d ". x, y): 18 19 return 0; 2011 (a) (30 pts) Draw a tree representing process creation and showing how processes are related (as shown in the lecture video). In this tree, each process will be represented by a small circle with a unique process name written inside the circle, including the values for the x and y variables. You can name the initial parent process as P1 and increment the number portion of this representation (P2, P3, P4, etc.) to name the newly created processes. For the convenience of grading, please draw the tree in a way that the parent process continues on the left path while the child goes to the right path in the tree after each fork operation. ANSWER to (a): 1. (50 pts) Assuming no errors and no cascading termination, trace the following program and answer the following questions: #include 2 include 3 inelude sint main(int arge, char *argv[])! pid ! *-0. y - 1: 9 1 - fork (): 101 - fork(): if (x !- 0) 12 y - fork: // End If 14 if (y > 0) 15 fork) : 16 // End If 17 printf("% dy - d ". x, y): 18 19 return 0; 2011 (a) (30 pts) Draw a tree representing process creation and showing how processes are related (as shown in the lecture video). In this tree, each process will be represented by a small circle with a unique process name written inside the circle, including the values for the x and y variables. You can name the initial parent process as P1 and increment the number portion of this representation (P2, P3, P4, etc.) to name the newly created processes. For the convenience of grading, please draw the tree in a way that the parent process continues on the left path while the child goes to the right path in the tree after each fork operation. ANSWER to (a)