#include #include /* * NUMPROC - Number of processes to run including parent process * * ie: NUMPROC-1 children will be spawned * */ #define NUMPROC 4 /* * The Message Structure */ struct msg { int iFrom; /* Who sent the message */ int wType; /* -1=termination, 0=request, 1=result, 2=additional request */ int wVal1; /* initial value in range */ int wVal2; /* final value in range */ int wTotal; /* total of all numbers in range (Max Range in add. mode) */ }; /* * Semaphore ID array * * 2*ID = Send * 2*ID+1 = Receive * */ int semid[2*NUMPROC]; /* * Mailboxes for all processes */ struct msg *inbox[NUMPROC];