Under what circumstances do page faults occur? Describe the actions taken by the operating system when a page fault occurs.
Read moreTable of Contents
Textbook Solutions for Operating System Concepts
Question
A page-replacement algorithm should minimize the number of pagefaults. We can achieve this minimization by distributing heavily usedpages evenly over all of memory, rather than having them compete fora small number of page frames. We can associate with each page framea counter of the number of pages associated with that frame. Then,to replace a page, we can search for the page frame with the smallestcounter.a. Define a page-replacement algorithm using this basic idea. Specificallyaddress these problems:i. What is the initial value of the counters?ii. When are counters increased?iii. When are counters decreased?iv. How is the page to be replaced selected?b. How many page faults occur for your algorithm for the followingreference 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.c. What is the minimum number of page faults for an optimal pagereplacementstrategy for the reference string in part b with fourpage frames?
Solution
The first step in solving 9 problem number 30 trying to solve the problem we have to refer to the textbook question: A page-replacement algorithm should minimize the number of pagefaults. We can achieve this minimization by distributing heavily usedpages evenly over all of memory, rather than having them compete fora small number of page frames. We can associate with each page framea counter of the number of pages associated with that frame. Then,to replace a page, we can search for the page frame with the smallestcounter.a. Define a page-replacement algorithm using this basic idea. Specificallyaddress these problems:i. What is the initial value of the counters?ii. When are counters increased?iii. When are counters decreased?iv. How is the page to be replaced selected?b. How many page faults occur for your algorithm for the followingreference 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.c. What is the minimum number of page faults for an optimal pagereplacementstrategy for the reference string in part b with fourpage frames?
From the textbook chapter Virtual
Memory you will find a few key concepts needed to solve this.
Visible to paid subscribers only
Step 3 of 7)Visible to paid subscribers only
full solution