For example when I read about different scheduling algorithms like First-Come-First-Serve
, Shortest Job First
, Priority Scheduling
, Round Robin
scheduling for all of them the measure is average wait time.
Consider a processes with run times of 21, 3, 6, 2 (msecs). Average wait time for First-Come-First-Serve
is (0 + 21 + 24 + 30)/4 = 18.75 msecs and for Shortest Job First
is (0+2+5+11)/4 = 4.5ms.
Does this mean Shortest Job First
is better? I understand the wait time is longer in the first one but this is not busy waiting, the CPU is busy executing tasks. Like 21 msec task first, first it is completed then next to the other one etc. Like shouldn't it take same amount of time to complete the tasks no matter the order? Any ideas?