Open In App

Introduction of Shortest Remaining Time First (SRTF) algorithm

Last Updated : 10 May, 2023
Like Article

Shortest Remaining Time First (SRTF) is the preemptive version of Shortest Job Next (SJN) algorithm, where the processor is allocated to the job closest to completion. 

This algorithm requires advanced concept and knowledge of CPU time required to process the job in an interactive system, and hence can’t be implemented there. But, in a batch system where it is desirable to give preference to short jobs, SRT algorithm is used. 

However, SRT involves more overheads than SJN, as the OS is required to frequently monitor the CPU time of the jobs in the READY queue and perform context switching. 


As illustrated above, for the same set of jobs, SRT algorithm is faster in execution than SJN algorithm. But, here the overhead charges, i.e., time required for context switching has been ignored. When a job is preempted, all of it’s processing information must be saved in it’s PCB for later when it is to be continued, and the contents of the PCB of the other job to which the OS is switching are loaded into the registers in the memory. This is known as Context Switching


  • SRTF algorithm makes the processing of the jobs faster than SJN algorithm, given it’s overhead charges are not counted. 
  • Allows for easier management of library updates or replacements without recompiling the program.
  • Enables efficient memory usage, as libraries can be shared among multiple instances of the program.
  • Provides better portability, as the program can be executed on different systems with compatible libraries available at runtime.


  • The context switch is done a lot more times in SRTF than in SJN, and consumes CPU’s valuable time for processing. This adds up to it’s processing time and diminishes it’s advantage of fast processing.
  • Slightly slower program startup due to the additional linking process.
  • Requires proper handling of library dependencies to ensure correct execution.
  • Debugging can be slightly more complex, as libraries are separate entities loaded at runtime.

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads