# Shortest Job First (SJF)

The optimal policy to minimize average response time is to schedule the shortest job first (SJF). In SE350, I learned this as shortest job first.

How does the scheduler know how long each task takes? It doesnâ€™t, so this is not meant as a practical policy. Itâ€™s a non-Preemption

By doing the shortest tasks as quickly as possible, SJF necessarily does longer tasks as slowly as possible (among policies that are work-conserving).

Everything is a tradeoff

There is a fundamental tradeoff between reducing average response time (through SJF) and reducing the variance in average response time (through FIFO).

SJF is how you should schedule in real life to appear doing â€śbusy workâ€ť.

Big limitation

Knowing the service time of the processes is what is hard. This is typically provided by the programmer.