Answered step by step
Verified Expert Solution
Question
1 Approved Answer
whereis fork? /usr/share/ma/man3/fork.3am.gz Fig 3.8 #include #include #include int main() { pid_t pid; /* fork a child process */ pid = fork (); if (pid
whereis fork? /usr/share/ma/man3/fork.3am.gz
Fig 3.8
#include
#include
#include
int main()
{
pid_t pid;
/* fork a child process */
pid = fork();
if (pid
fprintf(stderr, "Fork Failed");
return 1;
}
else if (pid == 0) { /* child process */
execlp(/bin/ls,ls,NULL);
}
else { /* parent process */
/* parent will wait for the child to complete */
wait(NULL);
printf("Child Complete");
}
return 0;
}
Q1. In this question, you will go through Section 3.3.1 entitled: "Process Creation" in your textbook. Next, in your Linux VM, go to the directory "ch3. Find and read the C program corresponding to Figure 3.8. Revise this code, so its child process can display the online manual for the facility "fork". Compile your code and run it. Q1. In this question, you will go through Section 3.3.1 entitled: "Process Creation" in your textbook. Next, in your Linux VM, go to the directory "ch3. Find and read the C program corresponding to Figure 3.8. Revise this code, so its child process can display the online manual for the facility "fork". Compile your code and run itStep 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