Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started