Related Articles

Related Articles

Difference between SJF and SRJF CPU scheduling algorithms
  • Last Updated : 23 Dec, 2020

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 a 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.

Similarities:

  • 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.

Differences:



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.

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :