Open In App

Shortest Job First CPU Scheduling with Predicted Burst Time

Shortest Job First (SJF) is an optimal scheduling algorithm as it gives maximum Throughput and minimum average waiting time(WT) and turnaround time (TAT) but it is not practically implementable because the burst time of a process can’t be predicted in advance. We may not know the length of the next CPU burst, but we may be able to predict its value. We expect the next CPU burst will be similar in length to the previous ones. By computing an approximation of the length of the next CPU burst, we can pick the process with the shortest predicted CPU burst.

Methods to Predict Burst Time

There are two methods by which we can predict the burst time of the process:



Static Method

We can predict the burst time by two factors using the static method:

1. burst timeProcess size: Let’s say we have Process Pold having size 200 KB which is already executed and its Burst-time is 20 Units of time, now let us say we have a New Process Pnew having size 201 KB which is yet to be executed. We take the Burst-Time of the already executed process Pold which is almost of the same size as that of the New process as the Burst-Time of the New Process Pnew.



2. Process type: We can predict burst time depending on the Type of Process. Operating System processes (like scheduler, dispatcher, segmentation, and fragmentation) are faster than User processes (Gaming, application software). Burst-Time for any New O.S process can be predicted from any old O.S process of similar type and the same for the User process.

Dynamic Technique

1. Simple average: Given n processes ( P1, P2… Pn)

Τn+1 = 1/n(Σi=1 to n ti)

2. Exponential average (Aging):

Τn+1 = αtn + (1 - α)Τn
αtn + (1 - α)αtn-1 + (1 - α)2αtn-2...+ (1 - α)jαtn-j...+ (1 - α)n+1Τ0 

Additional Considerations for SJF Scheduling Algorithm

Conclusion

SJF with predicted burst time is a practical and efficient CPU scheduling algorithm that can reduce the average waiting time of processes in the ready queue. By using historical data to predict the burst time of processes, it can make better scheduling decisions and adapt to changes in process behavior. However, the accuracy of the predicted burst time and the choice of the value of α need to be carefully considered to achieve optimal results.

FAQs on Shortest Job First CPU Scheduling with Predicted Burst Time

Q.1: How to calculate CPU burst time?

Answer:

We can calculate CPU burst time by using following formula.

Burst Time (B.T.) = Completion Time (C.T.) – Waiting Time (W.T.)

Q.2: Why do we predict burst time in SJF?

Answer:

One of the greatest scheduling methods is the SJF algorithm since it maximizes throughput while minimizing waiting times; however, the algorithm’s CPU burst time can’t be known in advance. this is a drawback.

Q.3: How many types of CPU burst capacity exist?

Answer:

There are mainly two types of CPU burst capacity.

  • CPU burst capacity percentage: the portion of your instance’s CPU performance that is available.
  • CPU burst capacity minutes: The duration of time that your instance has to reach 100% CPU use before bursting.
Article Tags :