Try to hand trace the output of this code by drawing a fork diagram that keeps track of each process' sleep() calls and printf() statements. Read more about the sleep() function at the Linux Man Page. Assume that if you remove all sleep() calls, the program would finish almost instantaneously (under 0.01 seconds). When you're ready to check your answer, press the button below and watch the animation to see how I draw a fork diagram for this program.
1
3
5
7
The output for this program is fixed. This means that the order of the output does not change from one run to another because the sleep() calls add "order" to the program.