Shortest Remaining Time First scheduling algorithm

It is a scheduling algorithm of an operating system Shortest Remaining Time First (SRTF).

Shortest Remaining Time First scheduling algorithm is mostly preemptive

Criteria:

  • The process that requires the shortest time to complete execution, is served first. 

Decision Mode:

  • preemptive: When a new process arrives, its total time is compared to the current process remaining time.
  • If the new job needs less time to finish than the current process, the current process is suspended and the new job started.

Implementation:

  • This strategy can be easily implemented by using FIFO. FIFO means First In First Out.
  • Firstly select that process which arrives and then completes it to the 1 unit of time after that
  • Check for the shortest remaining time from the arrival process only.
  • Similarly, All the processes get the execution.
  • Firstly for Finding Completion time, looking in Gantt chart from the back and complete of each process is completion time.
  • Secondly, Turn Around Time = Completion Time – Arrival Time.
  • Thirdly, Waiting Time = Turn Around Time – Burst Time.

For Example:

Process Arrival Time (A.T.) Burst Time (B.T.)
P0 0 10
P1 1 6
P2 3 2
P3 5 4

That is to say, 

  • Only one process is arriving at 0 time P0. so, we have to do the execution of process P0 for 1 unit time.
  • After that First process is getting the executes the first-time check for the shortest remaining time of arrived processes.
  • Similarly, All the processes execute likewise.

As a result, we get

Gantt Chart:

shortest remaining time first

Table:

Process Arrival Time Burst Time Completion Time Turnaround Time Waiting Time
P0 0 10 22 22 12
P1 1 6 9 8 2
P2 3 2 5 2 0
P3 5 4 13 8 4

Average Turnaround Time:(22+8+2+8)/4 = 10.0

Average Waiting Time: (12+2+0+4)/4 = 4.5

Throughput: 0.181818

Advantages:

  • Less waiting time.
  • Response time is less.

Disadvantages:

  • We can’t predict the completion time of the process.
  • Starvation is possible for a long process.

Comment for any query.
To learn more concept about SRTF go to 
https://www.geeksforgeeks.org/program-shortest-job-first-scheduling-set-2srtf-make-changesdoneplease-review/

For Android projects goto the ANDROID

Stay Connect with our app: – 

https://play.google.com/store/apps/details?id=com.edu.easyengineer

For Assignment Questions and Explanation of a theory topic visit:

http://mycandal.com/home/elementor-179/

About easyengineering 32 Articles
Easyengineering.in provides you to all subject and exam related materials online like GPSC, UPSC, IES, GATE, etc. As well as we provide daily job notification, some life-related books and other online courses which are useful too in your study.

Be the first to comment

Leave a Reply

Your email address will not be published.


*