Answered step by step
Verified Expert Solution
Question
1 Approved Answer
a) What is it doing? b) Identify all the system calls c) Indicate what output it will produce to the console d) For each system
a) What is it doing?
b) Identify all the system calls
c) Indicate what output it will produce to the console
d) For each system call, say what it does and how it changes the state of the process if at all.
void main()
{
pid_t pid, mypid;
pid = fork();
if (pid<0) {
printf("Error, fork failed ");
exit(0);
}
else if (pid==0) {
mypid = getpid();
printf("Child process pid is %d ",mypid);
sleep(10);
exit(0);
} else {
mypid=getpid();
wait(NULL);
printf("Parent process pid is %d ",mypid);
}
}
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