Question: Study the source code q1.c and q2.c. In addition to the parent process, how many descendant processes each program creates? Submit the following for each
-
Study the source code q1.c and q2.c. In addition to the parent process, how many descendant processes each program creates? Submit the following for each source code.
-
A diagram showing the hierarchical structures of all the processes (including the parent process)
-
-
Just give me the hierarchical structure with explanation so that I can make a video.I am attaching the code along with this.
-
q1.c
#include
#include int main(){ printf("before fork, my pid is %d " , getpid()); fork(); fork(); fork(); printf("done, my pid is %d ", getpid()); } q2.c
#include
#include int main(){ int i; printf("before fork, my pid is %d " , getpid()); for (i=0; i<3; i++){ if ( fork()== 0 ) printf("Hi, I am child. My pid is %d ", getpid()); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
