Thrashing and the working set
Step through windows and decide when to suspend.
Thrashing and the working set
Find the working set in each window, then decide whether the system is about to thrash.
Reference string (Δ = 10): 2 6 1 5 7 7 7 7 5 1 6 2 3 4 1 2 3 4 4 4 3 4 3 4 4 4 1 3 2 3
Window = refs 1–10: 2 6 1 5 7 7 7 7 5 1 → WS = {1, 2, 5, 6, 7}, WSS = 5.
Window = refs 11–20: 6 2 3 4 1 2 3 4 4 4 → WS = {1, 2, 3, 4, 6}, WSS = 5.
Window = refs 17–26: 3 4 4 4 3 4 3 4 4 4 → WS = {3, 4}, WSS = 2. The process has moved into a tighter locality and can give frames back.
Three processes have WSS 5, 4 and 6 → D = 15. With m = 12 frames, D > m → suspend one process. With m = 16, all can run.
Working-set strategy
Track each WSS; keep Σ WSS ≤ m; suspend a process when it is exceeded.
Page-fault frequency
Set upper and lower fault-rate bounds; add frames above the upper bound, remove below the lower bound.
Thrashing means…
If Δ is too small, the working set…
D = 30, m = 25. The OS should…