We know that FCFS suffers from the convoy effect but Question : Does SJF (Shortest Job First) suffer from the convoy effect and if yes then how ?
There are 2 version of SJF
Shortest Job first (SJF) which is Non preemptive mode , This will suffer from convoy effect as if the very first process which came is Ready state is having a large burst time . So it will be scheduled on CPU as it is the only process. Then soon after other processes came which have small burst time but 1st process will keep on executing as SJF is Non Preemptive Mode. This will affect the Avg. waiting time of the processes which will led to Convoy Effect.
Shortest Remaining Time First Preemptive version of SJF. This will never suffer from Convoy effect.
explanation : criteria in SJF is (arrival time + burst time) , so a job with shorter burst time wont arrive then we cant take it and in this case if it is non preemptive then SJF will also suffer from the convoy effect , you can take an example and check it
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.