CHILD3 executes code from parent.c upon return from fork(). After displaying its own and its parent's Process ID's it invokes one of the exec family of functions, say execvp, to switch to the new program in child3.c. It should be remembered that child3.c contains a full-fledged program, and has the function main() defined in it. As explained in the statement of the problem, this program writes on the screen the Process ID and the Real User ID of the calling process, and the Process ID of its parent. All the exec functions require the name of the executable file for the new program as the first argument and so we invoke the function of our choice with the character string constant "child3" as the first argument. Since the call to this exec function is made from parent.c, it behooves us to compile child3.c and have the object code placed in the file child3 (through the command cc child3.c -o child3) before we compile parent.c.
PARENT : My PID is .......
PARENT : My parent's PID is .....
PARENT : The parameters of the program call are .. .. .. .. .. ..
......
CHILD2 : My PID is .......
CHILD3 : My PID is .......
CHILD2 : My parent's PID is .....
....
PARENT : CHILD1 (PID ....) terminated at time ......
CHILD3 : My PID (from new program) is .....
CHILD1 : My PID is ....
.....