James Ross
James Ross

Reputation: 21

Preemptive Shortest Job First Sorting

Lets say I have two processes waiting to execute using Preemptive Shortest Job First (SJF).

Process 1:
Arrival Time = 0
Burst Time   = 5

Process 2:
Arrival Time = 2
Burst Time   = 3

At Time = 2, both processes will have the same burst time of 3. Would SJF sorting run process 2, since it had a higher initial burst time, or would it run of the processes since their burst times are currently the same?

Thanks :)

Upvotes: 2

Views: 865

Answers (1)

Mushrit Shabnam
Mushrit Shabnam

Reputation: 176

It's a very unique case, and in this case, it doesn't matter which job it executes first. Because both of the processes has 3 ( second or millisecond, whatever you say )s left for to finish execution. It becomes like a " First Come First Serve " scheduling algorithm.

These type of cases are also seen when a queue has multiple processes with their burst time sorted in ascending order, then SJF becomes FCFS.

Upvotes: 1

Related Questions