SLIDE 22 Maria Hybinette, UGA Maria Hybinette, UGA
Predicting Bursts in SJF
(weighting average = recursive)
- Key Idea: The past is a good
predictor of the future (an optimistic idea) – ‘habits’
– Weighted averages of:
- the most recent burst and the previous
guesses (recursive) {history}
– Approximate next CPU-burst duration from the durations of the previous burst and the previous guess). Average them.
– Recursive: it accounts for entire past history, previous burst always important
- BUT previous guesses and their
importance drops off ‘exponentially’ with the time of their burst. (it has been /2 many times)
G(n + 1) = w ∗ A(n) + (1 − w)G(n) Guess = Actual Burst / 2 + Previous Guess / 2
First Guess – Use a Default Value Here 10. (10+6)/2=8 (8+4)/2=6 (6+6)/2=6 …..
Maria Hybinette, UGA Maria Hybinette, UGA
Example
(get a feeling for exponential averaging)
- Default: 5 time units expected burst length.
- Assume: The ACTUAL bursts lengths are (oracle
Pythia told us this).
– 10, 10, 10, 1, 1,1 – Note that these are (of-course) not known in advance.
- The predicted burst times for this process works as
follows (n=1,2,3, …).
– Let G(1) = 5 as default value – When process p runs, its first burst actually runs 10 time units (see above).
G(n + 1) = w ∗ A(n) + (1 − w)G(n)
G(1) = 5 A(1) = 10 w=1/2 G(2) = 15/2= 7.5