Open In App

Shortest Job First CPU Scheduling with Predicted Burst Time

Last Updated : 04 Dec, 2023
Like Article

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.

  • OS Process: Schedulers, compilers, program managers, and many more operating system processes are examples of processes. Typically, their burst time is shorter—between three and five units of time.
  • User Process: User processes are those that are started by users. The following three categories of processes are possible.
  • Interactive Process: Interactive processes are those that interact with the user or whose execution is entirely dependent on human input. A few examples of these types of processes are games. Since they mostly rely on human interaction and don’t require CPU power for extended periods, their burst time needs to be reduced. As a result, they are primarily IO-bound processes.
  • Foreground Process: These are the processes that users employ to complete tasks such as using Microsoft Office, editors, utility software, etc. Because these processes are the ideal blend of CPU and IO bound, they have a little longer burst time.
  • Background Process: This facilitates the way other processes are carried out. They operate in covert mode. For instance, a key logger is a program that logs user activities on the system and the keys they press. They primarily require a CPU and do so for longer periods.

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
  • where α = is smoothing factor and 0 <= α <= 1 , tn = actual burst time of nth process, Τn = predicted burst time of nth process. General term,
αtn + (1 - α)αtn-1 + (1 - α)2αtn-2...+ (1 - α)jαtn-j...+ (1 - α)n+1Τ0 
  • Τ0 is a constant or overall system average.
  • If α = 0, Τn+1 = Τn i.e. no change in value of initial predicted burst time.
  • If α = 1, Τn+1 = tn i.e. predicted Burst-Time of new process will always change according to the actual Burst-time of nth process.
  • If α = 1/2, recent and past history are equally weighted.

Additional Considerations for SJF Scheduling Algorithm

  • The SJF algorithm is useful in scenarios where the processes have varying burst times and there is a need to minimize the average waiting time of processes in the ready queue.
  • One of the major drawbacks of the SJF algorithm is that it can lead to starvation for processes with longer burst times, as they may never get a chance to execute if shorter processes keep arriving.
  • Preemptive SJF can address the issue of starvation by allowing processes with shorter burst times to be interrupted by processes with even shorter burst times.
  • Predicting the burst time accurately can be challenging, especially for processes that have burst times that vary significantly over time.


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?


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?


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?


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.

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads