Question: Q 6 . Wait Solve textbook practice problem 8 . 4 Consider the following program: - - - - - - - - - -

Q6. Wait
Solve textbook practice problem 8.4
Consider the following program:
------------------------------code/ecf/global-waitprob1.c
int main()
{
int status;
pid_t pid;
printf("Start
");
pid = Fork();
printf("%d
",!pid);
if (pid ==0){
printf("Child
");
}
else if ((waitpid(-1, &status, 0)>0) &&
(WIFEXITED(status)!=0)){
printf("%d
", WEXITSTATUS(status));
}
printf("Stop
");
exit(2);
}
------------------------------code/ecf/global-waitprob1.c
A. How many output lines does this program generate?
B. What is one possible ordering of these output lines?

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!