Question: 2. (5 pts.) Consider the following code segment. Assume the parent processes will not exit until the children processes complete. How many times is Hi

2. (5 pts.) Consider the following code segment. Assume the parent processes will not exit until the children processes complete. How many times is "Hi" printed? Sketch a tree of how the processes are created. Answer: int main() { pidet pidi Rid = fork(); printf("Hi "); Rid = fork(); if (pid != 0) { pid = fork(); printf("Hi "); wait (NULL); } else{ printf("Hi "); wait (NULL); } wait (NULL); }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
