Right after the #include statements, add
#define CHILDREN 2. That defines the constant CHILDREN
and sets it equal to 2. Note that in C, this type of definition
does not end with a semi-colon.
Read the man pages for the fork and wait system calls.
Normally if you want to print a man page, you use the -t option,
as in man -t fork, but that does not seem to be working on
the irises. I will send mail soon with instructions for printing
Modify the program so that instead of creating a single child
it creates as many children as the value of CHILDREN. Each
child should print a message like, ``Hello from child 2.''
(Or whatever number the child happens to be).
WARNING: please be careful when you write this part of
the program, to make sure that the fork command is not contained in
an infinite loop. If you create a very large number of processes,
you can make the machine very slow, or even crash it.
The parent should wait for all its children to exit before
it exits. It should print a message acknowledging the death of
What do you notice about the order of the messages from the
children? What does that tell you about the scheduling policy on