Question: 5. (15 points) Answer the questions related to the code below. Note: there is no buffering for the printfs. int main(void) { int i =

5. (15 points) Answer the questions related to the code below. Note: there is no buffering for the printfs. int main(void) { int i = 0; printf("A"); i++; if (fork() > 0) wait (NULL); printf("B"); i++; if (fork() > 0) wait (NULL); printf("C"); i++; if (fork() > 0) wait (NULL); printf("D"); i++; return 0; (1) List all the possible outputs of the above code. If there are more than three, just list three. (2) How many processes are created including the top level process with the above code? What is the largest value of i among all the processes before they exit
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
