Question: undefined 1. Zombie Process Recall that when a child terminates, but its parent is not currently waiting, the terminated child process becomes a zombie process.

undefined 1. Zombie Process Recall that when a child terminates, but itsundefined

1. Zombie Process Recall that when a child terminates, but its parent is not currently waiting, the terminated child process becomes a zombie process. Use the following algorithm and specific instructions to develop a short, simple C program called rec06A. c to create a zombie process. a. Add the include directives for the stdlib.h and unistd.h libraries. b. Declare a variable called pid with the data type pid_t and invoke the fork () system call, assigning the result to pid. C. Write an if - else if - else branching statement to handle the child process, parent process, and error case, respectively. i. In the child process, exit immediately. ii. In the parent process, sleep for 5 seconds, then issue the system () system call with "ps -e -o pid,ppid, stat,user,cmd | grep $USER". This prints out the current PID, parent PID, status, user ID, and command process information. iii. In the error case, call the perror() system call with "fork error". Now, compile and run your program. After 5 seconds, you should see the result of the ps command. Specifically, look for the process with the Z+ status. This is an indication that it is a zombie process. This process should also be the child process of your parent ./a.out executable that contains the indicator. Now, on the command line, enter the ps -u $USER command to see your existing processes. You should notice that this zombie process no longer exists as it has been reaped by the init/systemd process. You will turn in this rec06A.c file to Canvas

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!