Question: 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 it
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
