forker.c
which is
linked to the web version of this homework contains a simple program
that loops three times, each time calling the fork
system
call described in section 4.3.1 of the textbook. Afterwards it
sleep
s (does nothing) for 30 seconds. Download this
file, compile it using the command
cc -o forker forker.cand then run it using the command
./forkerWhile the program is in its 30 second sleep, in a second terminal window do the command
ps xto get a listing of processes. How many processes are shown running the
./forker
command? Explain.
printf("Child Complete");has been removed. In the other variant, both that line and also the preceding line
wait(NULL);have been removed. Each of these variant programs is compiled and run in a shell terminal window. What difference might be observed between the two programs' behaviors? Explain. You are welcome to try the experiment if you would like.
Instructor: Max Hailperin