Scheduling Algorithms
- Round-Robin (RR) Scheduling.
- In this algorithm, each process is assigned the same time slice (also called time quantum), during which the process can execute on the CPU. When the time slice passes, the Scheduler removes the process and brings a different process to run instead on the CPU.
- When a process is removed from the CPU but some ms still remain in its burst time, the process will be moved to the end of the queue and will wait until the other processes use their time slices.
- Processes get to run based on the time they arrive at the ready queue, so RR mostly resembles FCFS.
- Advantage: The average response time decreases (processes respond faster) since all the processes equally share CPU time. Also, no starvation occurs for the same reason.
- Disadvantage: Too large or too small time slices will cause issues. Too large time slices will make the algorithm behave more like FCFS. Too small time slices will increase the number of context switches and, hence, the extra time spent on performing context switches. In other words, it is difficult to select an optimal time slice.