Develop a program that models a single cpu system. This is a deterministic model in that the time of entry and time of execution are both predetermined for every process submitted for execution. Assume 4 priority levels for the processes arriving to be serviced by the cpu, with priority 1 being the lowest and 4 as the highest. When a process arrives and the cpu is idle, it will capture the cpu and won't relinquish control until it is done. This is always true except for the cases when a new arrival occurs and the new process has a higher priority than the one in control. In such situation, the new process will preempt the old and the old one must wait. When a new process arrives and CPU is busy with another who has the same or higher priority, the new process is the one that must wait. When its time to pick a process among those who are waiting, the process with the highest priority must be picked, if more than one has that priority, the one with the earliest arrival time must be picked.
1 1 5 3 2 10 5 1 3 12 7 2 4 20 2 3 5 21 9 4 6 22 2 4 7 23 5 2 8 24 2 4
process ID =1 process Arrival Time =1 process Service Time =5 process Priority =3 Total Time in System =5 process ID =3 process Arrival Time =12 process Service Time =7 process Priority =2 Total Time in System =7 process ID =5 process Arrival Time =21 process Service Time =9 process Priority =4 Total Time in System =9 process ID =6 process Arrival Time =22 process Service Time =2 process Priority =4 Total Time in System =10 process ID =8 process Arrival Time =24 process Service Time =2 process Priority =4 Total Time in System =10 process ID =4 process Arrival Time =20 process Service Time =2 process Priority =3 Total Time in System =15 process ID =7 process Arrival Time =23 process Service Time =5 process Priority =2 Total Time in System =17 process ID =2 process Arrival Time =10 process Service Time =5 process Priority =1 Total Time in System =32