9.13 A page-replacement algorithm should minimize the number of page faults. We can achieve this minimization by distributing heavily used pages evenly over all of memory, rather than having them compete for a small number of page frames. W’e can associate with each page frame a counter of the number of pages associated with that frame. Then, to replace a page, we can search for the page frame with the smallest counter.
a. Define a page-replacement algorithm using this basic idea. Specifically address these problems:
1. What the initial value of the counters is
Zero(0)
2. When counters are increased
Whenever a new page is associated with that frame.
3. When counters are decreased
Whenever one of the pages associated with that frame is no longer required.
4. How the page to be replaced is selected
Find a frame with the smallest counter. Use FIFO for breaking ties.
b. How many page faults occur for your algorithm for the following reference string, with four page frames?
1, 2, 3, 4, 5, 3, 4,1, 6, 7, 8, 7, 8, 9, 7, 8, 9, 5, 4, 5, 4, 2.
14 page faults.
c. What is the minimum number of page faults for an optimal pagereplacement strategy for the reference string in part b with four page frames?
11 page faults.