    /* 
      Create lots of child processes and keep them busy.
    */

    #include <stdio.h>

    #define NUM_CHILDREN 50
    #define NUM_DELAY_LOOPS 50000000

    void main()
    {
       int i, j, pid, status;
       for(i=0; i < NUM_CHILDREN; i++)
         if ((pid = fork()) == 0) break;
       if (pid != 0) { 
         /* original process code */ 
         for(i=0; i < NUM_CHILDREN; i++)
           waitpid(-1, & status, 0);
         printf("Children are all done. Bye.\n"); 
       } else {
         /* child process code */ 
         /* wait for everyone to be born before fighting for CPU */ 
         sleep(10);
         /* now try to get CPU and waste clock cycles doing nothing! */ 
         for (i=0; i < NUM_DELAY_LOOPS; i++) ;
       }
    }





