Scheduling Algorithms
We now describe several scheduling algorithms that the CPU Scheduler could use to decide in what order processes will run on the CPU. Here, we assume that there is one CPU.
- First-Come First-Serve (FCFS) Scheduling.
- In this algorithm, whichever process arrives first will run first.
- The CPU Scheduler uses a queue (FIFO) data structure to implement the algorithm.
- The FCFS algorithm is cooperative in nature since the Scheduler won't forcefully evict a process from running on the CPU, and the process will keep running there until it willingly releases the CPU.
- Advantage: this is the simplest scheduling algorithm to implement.
- Disadvantage: the average waiting time is long.
- As a consequence, in interactive systems, users might need to wait for an exceptionally long time to get a response from an application that they run. Also, because many processes will wait for a single, long process to finish using the CPU, other devices, like I/O devices, will remain idle and unutilized for a long time.