Multiple-processor CPU Scheduling Simulation

  The CPU Scheduler is a key component of any multiprogramming operating system (OS) kernel. It is important to understand the details of the CPU scheduling in order to fully comprehend the dynamic behavior of the operating systems. In this project, you are asked to write some C programs to simulate the following three CPU scheduling algorithms for a multi-core computing system consisting of four (4) homogeneous CPUs: 1) FCFS (First-Come-First-Served) scheduling. 2) RR (Round Robin) scheduling with time quantum q=2 milliseconds, q=12 milliseconds, and q=50 milliseconds, respectively. 3) Three-level feedback-queue (FBQ) preemptive scheduling employing queue Q0 (RR, quantum q=10 milliseconds), queue Q1 (RR, quantum q=30 milliseconds), and queue Q2 (FCFS) as shown in Figure 5.9 in the textbook. Read the corresponding text for details about this scheduling algorithm and include in your implementation the following: (a) a process exceeding its time quantum should be preempted and demoted by placing it into Q1 if its original queue was Q0 or into Q2 if its original queue was Q1 (b) a process finishing its I/O bursts should be promoted by placing it into Q0 (c) a process preempted for servicing a higher priority queue should be placed in the beginning of its original ready queue When you implement your simulations, if two or more processes are identical in terms of scheduling criterion, you should give precedence to the process that has the smallest process ID (PID) number. Based on the given static CPU workload in the CPULoad.dat text file your programs must perform the necessary simulations and answer all the following questions for each of the above CPU schedulers: 1) What is the average waiting time? 2) What is the average turnaround time? 3) When does the CPU finish all these processes? What is the average CPU utilization by this time point? (Note that at any time instance, CPU utilization is 400% if all 4 CPUs are running, 300% if only 3 CPUs are running, 200% for 2 CPUs, 100% for only 1 CPU, and 0% if no CPU is running.) 4) How many context switches occur in total during the execution? (Note that you should count as context switches only the cases where a process is preempted during its CPU burst, and not the cases where a process terminates or just finishes its current CPU bursts and goes to I/O.) 5) Which process is the last one to finish?