The convoy effect is most commonly associated with FCFS, because FCFS can place a long CPU-bound process before many short processes.
SJF usually reduces the convoy effect because it chooses the shortest job first. However, since SJF is non-preemptive, a long process that has already started can still cause short processes arriving afterward to wait.
SJF does not know the exact future CPU burst time
SJF stands for Shortest Job First. To choose the shortest job, the scheduler needs to know or estimate how long each process will run.
But in a real system, the scheduler generally cannot know the future CPU burst time exactly.
So SJF uses an estimate of the next CPU burst, often based on previous CPU bursts.
SJF:
- Non-preemptive scheduling
- Selects the process with the shortest CPU burst time
- Once a process starts executing, it cannot be interrupted by another process.
SRTF (Shortest Remaining Time First):
- Preemptive version of SJF
- If a new process arrives with a shorter remaining burst time, the currently running process can be preempted.