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

 4. (20 points) Answer the questions related to the code below.

4. (20 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++; fork(); printf("B"); i++; fork(); printf("C"); i++; fork(); printf("D"); i++; return 0; (1) Is "ABCBCDCDCDDDDDD" a feasible output? If no, why? (2) Is ABBCDCCDDCDDDDD a feasible output? If no, why? (3) Is "ABCDDCDDBCDDDCD a feasible output? If no, why? (4) IS "ABCCDDCBCDDDDDD" a feasible output? If no, why? (5) Is "ABCBDCCDCDDDDDD a feasible output? If no, why? (6) 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

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!