Question: 2 . Using the following program, explain what the output will be at LINE A , B , C , D and E . Explain
Using the following program, explain what the output will be at LINE A B C D and E Explain why you have different pids and why these process ids are different for each run. Note that getpid returns the process ID and getppid returns the parent process ID Use ps command to find the bash PID and compare it with the one you find. To get full mark show the print screen. Dont explain the code but explain what you understand from the screen. #include #include #include int main pidt pid, pid; pid getpid; printfCreator: pidd
pid; E fork a child process pid fork; if pid error occurred fprintfstderr "Fork Failed"; return ; else if pid child process pid getpid; printfChild Process: Process ID pid : d
pid; A printfChild Process: Process ID pid using getpid: d
pid; B printfChild Process: Process ID pid using getppid: d
getppid; C else parent process pid getpid; printfParent Process: Process ID pid : d
pid; D printfParent Process: Process ID pid using getpid : d
pid; E printfParent Process: Process ID pid using getppid: d
getppid; F waitNULL; return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
