Documente Academic
Documente Profesional
Documente Cultură
Page Replacement
A. Manoj Wednesday,
November 15,
2017
2
A. Manoj Wednesday,
November 15,
2017
Optimal Algorithm
Replace page that will not be used for longest
period of time
3
A. Manoj Wednesday,
November 15,
2017
A. Manoj Wednesday,
November 15,
2017
A. Manoj Wednesday,
November 15,
2017
A. Manoj Wednesday,
November 15,
2017
A. Manoj Wednesday,
November 15,
2017
A. Manoj Wednesday,
November 15,
2017
A. Manoj Wednesday,
November 15,
2017
A. Manoj Wednesday,
November 15,
2017
Counting Algorithms
Keep a counter of the number of references that
have been made to each page
A. Manoj Wednesday,
November 15,
2017
Thrashing
If a process does not have enough pages, the page-
fault rate is very high.
Since all its pages are in active use, there exists some
need that it must replace the pages.
Then it quickly faults again, and again.
This high paging activity is called Trashing.
A process is trashing if it is spending more time
paging than in executing.
A. Manoj Wednesday,
November 15,
2017
Thrashing
13
A. Manoj Wednesday,
November 15,
2017
Working-Set Model
Working-set window : A fixed number of page
references
Example: 10,000 instruction.
WSSi (working set of Process Pi) = total number of
pages referenced in the most recent (varies in
time)
if too small will not encompass entire locality
Locality: It is a set of pages that are actively used
together.
if too large will encompass several localities
if = will encompass entire program
14
A. Manoj Wednesday,
November 15,
2017
Working-Set Model
= WSSi = total demand frames
if > m => Thrashing Policy
if > m, then suspend one of the processes
15
A. Manoj Wednesday,
November 15,
2017
1. If the actual page fault exceeds the upper bound then we allocate the process
to another frame
2. If the actual page fault falls below the lower limit, we remove a frame from the
process.
Thus we can directly measure and control the page-fault rate to prevent
trashing.
16
A. Manoj Wednesday,
November 15,
2017