Question: ----------------------------------- Figure 1 ------------------------------------------------ #include #include #include int main() { int fd; pid_t pid1=-1, pid2=-1; /* process-id */ switch(pid1 = fork()) { case -1: /*

----------------------------------- Figure 1 ------------------------------------------------
#include
#include
#include
int main()
{
int fd;
pid_t pid1=-1, pid2=-1; /* process-id */
switch(pid1 = fork()) {
case -1: /* error */
perror("fork failed");
break;
case 0:
break;
default:
switch(pid2 = fork()) {
case -1: /* error */
perror("fork failed");
break;
case 0:
break;
default:
} // end of switch(pid2 = ...
} // end of switch(pid1 = ...
} // end of main()
answer a - f and you will get thumbs up 100%
The template C code given in Figure 1 creates the following process architecture. Suppose that it created these 3 processes with their corresponding process ids. Provide the values of the variables, pid1 and pid2, when each process is about to terminate, and enter them into Blackboard "Final Exam Submission." (30 points) (a) For Parent, pid1 = ? (b) For Parent, pid2 = ? (c) For Child1, pid1 = ? (d) For Child1, pid2 = ? (e) For Child2, pid1 =
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
