40 likes | 53 Views
Thrashing and Working Set. Thrashing too many page faults very low CPU utilization Need to reduce page faults as much as possible
E N D
Thrashing and Working Set Thrashing too many page faults very low CPU utilization Need to reduce page faults as much as possible Working set (per process) = a subset of a process’ pages that the process would need in order to execute smoothly (no or very few page faults) over some period of time But we do not know the future need of the process … how would we be able to construct the working set? Assume locality. “What happened in the recent past will carry over to the near future.” HKU / POS-A
Working-set window () = how far we look back in time time 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 4 4 4 3 4 4 = 8 = 8 working set = {1,2,3,4,5,6} working set = {1,2,3,4} There seems to exist some locality in this reference string (where?) HKU / POS-A
Ideally, we should update the working set after every page reference t 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 4 4 4 3 4 4 WS = {1,2,3,4,6} WS = {1,2,3,5,6} (5 out, 4 in) Updating at every reference, however, is too expensive HKU / POS-A
We could instead do the update periodically (eg., once every 5 references, as in the following which uses a of size 5) ** Note that this method is an approximation (why?) Everytime a page is referenced, its “reference bit” is set 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 4 4 4 3 4 4 Timer interrupt:all those pages whose reference bit is set is put/retained in the WS; clear all reference bits HKU / POS-A