Question: ( 1 % Below is the test _ fork.c file which creates 3 different types of topologies of the processes ( linear , Binary tree

(1% Below is the test_fork.c file which creates 3 different types of topologies of the processes
(linear, Binary tree and star topology). Save the code in a file and name it test_fork_toplogies.c,
compile and run it. Note down the output for each topology and create graphs for each. For
example, for star topology, the graph will look something like this:
For the graphs, use the output trom the command window and understand the flow to create the
graphs. Write down your description of the flow generated from each topology. Do not exceed For the graphs, use the output from the command window and understand the flow to create the
graphs. Write down your description of the flow generated from each topology. Do not exceed
the length to more than 1 page. You will need to pay close attention to the exit and wait
commands in the code to understand the flow:
#include child_pid = getpid();
parent_pid = getppid();
printf("2. Child Process (ID): %d, parent process (ID): %dln", child_pid, parent_pid);
}
exit(0);
}
wait(NULL);
}
printf("InStar topology of processes: ln
for (int i=0;i6;i++)
if (fork()==0){
child_pid = getpid();
parent_pid = getppid();
print("Child Process (ID): %d, parent process (ID): %dln", child_pid, parent_pid);
exit(0);
}
}
for (int i=0;i5; i++)
wait(NULL);
}
return 0;
( 1 % Below is the test _ fork.c file which

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 Programming Questions!