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

  1. 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.

    1. A diagram showing the hierarchical structures of all the processes (including the parent process)

  2. Just give me the hierarchical structure with explanation so that I can make a video.I am attaching the code along with this.

  3. 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

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!