/********************************************************************** Project 2: Multiprogramming Part I SECTION 0102 By: Mohamed S. Aboutabl e-mail: aboutabl@cs.umd.edu File: proc.c Creadted on: 10/3/1992 Contents: User Processes to be run concurrently 1. init() : Initial process, creates other ones & terminates 2..4 process_a() , _b() , and _c() are three examplar processes that are to be run concurently 5. wait() : busy wait for a key to be pressed Simon Hawkin 03/1998 - Added conditional preprocessing. [1] An enclosed test ("proc.c", or "encl.c"). **********************************************************************/ #include "cmsc412.h" #include "user412.h" #if !defined (NULL) #define NULL 0 #endif #if defined (DELAY) #undef DELAY #endif #define DELAY 10000u int Process_a ( int , char ** ) ; int Process_b ( int , char ** ) ; int Process_c ( int , char ** ) ; int Process_d ( int , char ** ) ; int Process_e ( int , char ** ) ; void Wait(void) ; /*-------------------------------------------------------------------*/ int Init( int argc , char ** argv ) { unsigned i; /* loop index */ int scr_sem, /* sid of screen semaphore */ id , /* ID of child process */ count ; /* child process's argc */ char * argument[10] ; /* pointer to a maximum of 10 arguments */ scr_sem = Create_semaphore ( "screen" , 1 ) ; P ( scr_sem ) ; Cprintf ("\n Test 1. Delay=%u\n\n", DELAY ); Cprintf ("\n*************This is the init procedure*********\n"); Cprintf ("I have %2d arguments. They are \n" , argc ); for ( i=0 ; i