12
votes

In the FCFS scheduling algorithm the drawback is that if a process P1 with a higher burst time comes before some processes P2,P3... with much smaller burst times then the average waiting time and average completion time is pretty high.

A solution to this problem is to schedule the Shortest Job First(SJF Algo).

But how is the burst time computed in advance? Does the developer specify a formula by which (according to the resources available) the burst time to perform a job is computed in advance?

2

2 Answers

6
votes

Estimating burst time of a process is a very large topic . in general scheduler estimates the length of the next burst based on the lengths of recent cpu bursts. basically what we do is to guess the next CPU burst time by assuming that it will be related to past CPU bursts for that process .

A quick google search led me to this article which will give you a basic idea .

here is a more detailed article

4
votes

This can be done using an exponential average estimation formula-

Estimated CPU Burst time for (n+1)th CPU burst=(alpha)(Actual CPU Burst time for nth CPU Burst)+(1-alpha)(Estimated CPU Burst time for nth CPU Burst).

where, alpha=a constant varies between 0<=alpha<=1.

Actual CPU Burst time for nth CPU burst= It is the most recent CPU Burst time of the process/job.

Estimated CPU Burst time for nth CPU burst= It gives us an idea of history of the process/job ie how previously we have estimated CPU Burst time.

For the first time execution (alpha=1), we have to execute the process/job once. this gives us (Actual CPU Burst time for nth CPU Burst),

Now, we can estimate the upcoming CPU burst time values by varying alpha.