Shortest Job First CPU Scheduling with predicted burst time
Prerequisite – CPU Scheduling, SJF – Set 1 (Non- preemptive), Set 2 (Preemptive)
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 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. There are two methods by which we can predict the burst time of the process :
1. Static method – We can predict the Burst-Time by two factors:
- Process 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.
- Process type – We can predict Burst-Time depending on the Type of Process. Operating System process(like scheduler, dispatcher, segmentation, fragmentation) are faster than User process( 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.
Simple average – Given n processes ( P1, P2… Pn)
Τn+1 = 1/n(Σi=1 to n ti)
- 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 actual Burst-time of nth process.
- If α = 1/2, recent and past history are equally weighted.
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.
Please Login to comment...