Difference between SJF and SRJF CPU scheduling algorithms
1. Shortest Job First (SJF) :
The Shortest Job First (SJF) is a scheduling policy that selects the waiting process with the smallest execution time to execute next. It is also known as Shortest Job Next (SJN) or Shortest Process Next (SPN). It is a non-preemptive scheduling algorithm.
2. Shortest Remaining Job First (SRTF) :
The Shortest Remaining Job First (SRJF) is the preemptive version of SJF scheduling. In this scheduling algorithm, the process with the smallest amount of time remaining until completion is selected to execute. Processes having same arrival time will convert SRTF to SJF.
- Both SJF and SRJF are practically not feasible as it is not possible to predict the burst time of the processes.
- Both SJF and SRJF may lead to process starvation as long processes may be held off indefinitely if short processes are continually added.
- Both SJF and SRJF are considered same once all the processes are available in the ready queue. This is because after the processes are added in the ready queue, no preemption is carried out.
|Shortest Job First:
||Shortest Remaining Job First:
|It is a non-preemptive algorithm.
||It is a preemptive algorithm.
|It involves less overheads than SRJF.
||It involves more overheads than SJF.
|It is slower in execution than SRJF.
||It is faster in execution than SJF.
|It leads to comparatively lower throughput.
||It leads to increased throughput as execution time is less.
|It minimizes the average waiting time for each process.
||It may or may not minimize the average waiting time for each process.
|It may suffer from priority inversion.
||It may suffer from convoy effect.
|It involves lesser number of context switching.
||It involves higher number of context switching.
|Short processes are executed first and then followed by longer processes.
||Shorter processes run fast and longer processes show poor response time.
Level Up Your GATE Prep!
Embark on a transformative journey towards GATE success by choosing Data Science & AI
as your second paper choice with our specialized course. If you find yourself lost in the vast landscape of the GATE syllabus, our program is the compass you need.