Comparison between operating system schedulers

Operating systems have CPU that allow for tasks to be executed. However, these tasks need to be processed in an order that is not conflicting and based on priorities. Moreover, as computational complexities increase, the CPU has to manage more tasks and allocate them to its single CPU. This process is done using different schedulers suited for different requirements.

Schedulers

Schedulers are unique algorithms in our operating systems to manage process scheduling. They are different policies to judge how well a scheduler works.

  1. We use a standard scheduling metric called the turnaround time, which is the time the task takes minus the time at which the task arrives in the system.

  1. Another metric is the response time, defined as the time from when the task arrives to the first time it is scheduled.

  1. We determine the workload, the number of processes running in the system.

  2. Finally, the fairness metric is defined by how evenly the workload gets divided, and it aims for every workload to get an equal share of the CPU time and computation.

First in, first out (FIFO)

FIFO is the most simplistic implementation of a scheduler as it follows that the first task to enter the queue is the first to be processed, and so on. It is easy to implement, and it works pretty well given certain constraints. However, if we do not assume that all tasks run at the same time, FIFO can cause queuing problems.

FIFO Scheduler
1 of 5

In our example above, our tasks A, B, C, and D arrive at the same time and are enqueued into our scheduler. However, we can instantly see a problem in our scheduling algorithm. The issue with the FIFO scheduler is that it does not consider the time for a task. This means that tasks that take a shorter time will get stuck behind a longer task and, therefore, result in a non-optimal solution to our problem.

Shortest job first (SJF)

To solve the problems in FIFO, we can use the SJF algorithm. This works by sorting the tasks based on their length and enqueues them based on their time. If we consider a system where all tasks arrive at the same time then SJF is an optimal scheduler. However, that is mostly not the case.

SJF Scheduler
1 of 5

In our example above, our tasks A, B, C, and D arrive at the same time and enqueued into our scheduler based on their task length. However, if we take assume that all of our tasks do not arrive at the same time then we can run into a problem. The problem is that as tasks arrive, they will be enqueued at the start, i.e., before the tasks are already in the queue. This leads to the same problem as before.

Shortest time-to-ompletion first (STCF)

Based on our assumption that not all jobs arrive at the same time, we can use the STCF scheduler to solve the problem faced in SJF. The STCF scheduler does this by putting on hold the current running task and allowing the freshly arrived task to be run if its runtime is less than the runtime of the current task. In short, it schedules the task which has the least time left.

STCF Scheduler
1 of 6

In our example above, tasks B, C, and D arrive at the same time and are enqueued into our scheduler. However, at the time of 20 units, task A arrives. To compensate for it, the scheduler compares the time left for tasks B and A. As the time for task A is less, it holds task B and enqueues task A in front. After task A, task B is enqueued. Overall, STCF is the optimal scheduler in situations where we know the runtime of each task and all tasks only use the CPU and not I/O.

Round robin (RR)

Alternatively, if we do not know the runtime of each task, we can use the RR scheduler. In it, the RR scheduler runs each task for a certain time slice. Then, it shifts to another task in the queue. It loops this process until all tasks are finished. Moreover, the time slice dictates how efficiently the scheduler will run and must be a multiple of the timer-interrupt period. A proper slice time will prevent each task from taking too much time while also making sure that tasks are not swapped too quickly which can create more problems in loading and unloading tasks.

RR Scheduler
1 of 6

In our example above, tasks A and B are enqueued into the scheduler. Each task runs for 10 units and is then swapped with the other tasks. This process repeats itself until all tasks have been run to completion.

Conclusion

Overall, schedulers play an important role in operating systems and task delegations. They provide policies that help schedule tasks that allow load balancing and resource utilization. These schedulers aim to provide fairness among processes or threads and enable maximum throughput i.e., increase processing speeds as more tasks can be completed in a given amount of time.

Free Resources

Copyright ©2026 Educative, Inc. All rights reserved