Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can someone do it asap The purpose of this recitation is to write two short C programs showing the parent-child process relationship in Linux using

can someone do it asap

image text in transcribed

The purpose of this recitation is to write two short C programs showing the parent-child process relationship in Linux using the fork() system call. Specifically, we will look at how a zombie and orphan process are created as well as handled by the operating 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 reco5A.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 topid 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 3 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. ii. In the error case, call the perror ) system call with "fork error". Now, compile and run your program. After 3 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 process

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Filing And Computer Database Projects

Authors: Jeffrey Stewart

2nd Edition

007822781X, 9780078227813

More Books

Students also viewed these Databases questions

Question

=+a. When the investment accelerator is large or when it is small?

Answered: 1 week ago