Question: Problem 1 ( 1 0 points ) In class, we used two C programs to show regualar.c: - A parent creates a child process, waits
Problem points
In class, we used two programs to show
regualar.c: A parent creates a child process, waits for the child to complete, then exits.
zombie.c: A parent creates a child process then goes to sleep without waiting for the
child to complete.
The child exits while its parent is sleeping and becomes a "zombie".
When the parent exits, the child process is reparented by init, which
cleans up the zombie process automatically.
Create a new program orphan. where a parent creates a child, exits before the child completes hint:
you may put the parent into sleep for a short period of time; meanwhile, also put the child into sleep for a
period of time that is longer than parent leaving it an "orphan" process. The orphan is reparented by
init and exits eventually.
Make sure your program compiles and runs. The following is a sample of what the program is supposed
to output:
a $ gcc orphan.c o orphan
$orphan
parent: Parent's PID :
child: Child's PID :
child: Child's Parent ID :
parent: Parent exits. Child becomes an orphan
a $
child: Orphan Child's Parent ID : init Orphan is reparented.
child: Orphan Child exits.
a $
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
