Question: You can use getpid ( ) to get the process id that is currently running. Like this: int pid = getpid ( ) ; Remember
You can use getpid to get the process id that is currently running. Like this:
int pid getpid;
Remember that the original fork call returns the child process id for the parent to
use!!!!
Obviously, the process id numbers will be different because each computer has its
own process id numbers!!!!
The challenge here is to use the waitNULL; properly.
Create a program that prints the following, in the same exact order:
I am the parent and my process id is:
My child was created with child process id:
I am the parent, now waiting for my child process to end...
I am the child process! and my process id is:
Child process has ended!!!
I am the parent, my child has ended!
parent process has ended!!!
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
