Answered step by step
Verified Expert Solution
Question
1 Approved Answer
#include #include #include #include int main() { pid_t pid; pid = fork(); if (pid fprintf(stderr, Fork failed. ); return 1; } else if (pid ==
#include
#include
#include
#include
int main()
{
pid_t pid;
pid = fork();
if (pid
fprintf(stderr, "Fork failed. ");
return 1;
}
else if (pid == 0) { /* child process */
execl("./long1", "long1", NULL);
}
else { /* parent process */
wait(NULL);
printf("Parent says: child has exited. ");
}
return 0;
}
5. Programming Assignment. Modify the program orphan_hw3.c so that the child process becomes an orphan process. If you wish to work in C++, you can do so; you will need to modify the file orphan_hw3.c accordingly. Running the program: make sure that the executable file long1 is in the same directory as your orphan program. Capturing process information. Use the script hw3_check.sh to capture process informa- tion as you run your program. To do so, you will need to execute your modified orphan_hw3.c program and then immediately execute hw3_check.sh. The script will save the information in a text file. What to hand in: submit your modified version of orphan_hw3.c along with a README.txt file containing the output from the text file generated by hw3_check.sh along with a brief explanation of what you observedStep 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