/********************************************************************** Project 2: Multiprogramming Part I SECTION 0102 By: Jeff Hollingsworth e-mail: hollings@cs.umd.edu File: proc2.c Created on: 3/6/1996 Contents: User Processes to be run concurrently 1. Init() : Initial process, creates other ones & terminates 2..4 Long() , Ping() , and Pong() are three examplar processes that are to be run concurently. Long() is a CPU intensive job, while Ping() and Pong() bounce back between one another. 5. Wait() : busy wait for a key to be pressed **********************************************************************/ #include "cmsc412.h" #include "keyboard.h" #include "queue.h" #include "kernel.h" #define NULL 0 #define DELAY 500 extern int Get_time_of_day(void); int Long ( int , char ** ) ; int Ping ( int , char ** ) ; int Pong ( int , char ** ) ; void Wait( int ) ; /*-------------------------------------------------------------------*/ /* ignore unused paramters for the processes */ #pragma warn -par int Init( int argc , char ** argv ) { int i , /* loop index */ 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*************This is the init procedure*********\n"); Cprintf ("I have %2d arguments. They are \n" , argc ); for ( i=0 ; i