For 3 page frames, the following is the reference string: 7 2 3 2 1 3 0 6 2 3 0 4 2 1 3 2 1 7 1 8 How many page faults does the LRU page replacement algorithm produceAnswer( Please choose a correct answer ) CLEAR10151216
Question
For 3 page frames, the following is the reference string: 7 2 3 2 1 3 0 6 2 3 0 4 2 1 3 2 1 7 1 8 How many page faults does the LRU page replacement algorithm produceAnswer( Please choose a correct answer ) CLEAR10151216
Solution
To solve this problem, we need to simulate the Least Recently Used (LRU) page replacement algorithm. Here are the steps:
- Start with an empty memory of 3 page frames.
- For each page in the reference string, do the following:
- If the page is already in memory, continue to the next page.
- If the page is not in memory and there is an empty frame, load the page into the empty frame and continue to the next page.
- If the page is not in memory and there are no empty frames, find the page that was least recently used and replace it with the current page. This is a page fault.
- Count the number of page faults.
Let's apply these steps to the given reference string:
7 2 3 2 1 3 0 6 2 3 0 4 2 1 3 2 1 7 1 8
- Start with empty memory: [_, _, _]
- Load 7 into memory: [7, _, _] (1 page fault)
- Load 2 into memory: [7, 2, _] (2 page faults)
- Load 3 into memory: [7, 2, 3] (3 page faults)
- 2 is already in memory.
- Replace 7 with 1: [1, 2, 3] (4 page faults)
- 3 is already in memory.
- Replace 1 with 0: [0, 2, 3] (5 page faults)
- Replace 3 with 6: [0, 2, 6] (6 page faults)
- Replace 6 with 2: [0, 2, 2] (7 page faults)
- 3 is not in memory, replace 0 with 3: [3, 2, 2] (8 page faults)
- 0 is not in memory, replace 2 with 0: [3, 0, 2] (9 page faults)
- Replace 2 with 4: [3, 0, 4] (10 page faults)
- Replace 4 with 2: [3, 0, 2] (11 page faults)
- Replace 2 with 1: [3, 0, 1] (12 page faults)
- 3 is not in memory, replace 0 with 3: [3, 3, 1] (13 page faults)
- 2 is not in memory, replace 1 with 2: [3, 3, 2] (14 page faults)
- 1 is not in memory, replace 3 with 1: [1, 3, 2] (15 page faults)
- 7 is not in memory, replace 1 with 7: [7, 3, 2] (16 page faults)
- 1 is not in memory, replace 2 with 1: [7, 3, 1] (17 page faults)
- 8 is not in memory, replace 1 with 8: [7, 3, 8] (18 page faults)
So, the LRU page replacement algorithm produces 18 page faults for the given reference string with 3 page frames.
Similar Questions
Consider the following page reference string. 1 2 3 4 2 1 5 6 2 1 2 3 7 6 3 2 1 2 3 6 For FIFO page replacement algorithms with 3 frames, the number of page faults is?a.15b.14c.11d.16
the page faults.(c) Repeat (b) above for the LRU page replacement algorithm. (d) What would be the lowest number of page faults achievable in this example, assuming an optimal page replacement algorit
The sequence of pages which are to be referred by microprocessor is as follows:D,C,B,A,D,C,E,D,C,B,A,BThe number of page faults that will occur in the algorithm LRU with three page frames will beSelect one:a. 9b. 10c. 8d. 7
The system uses 5 page frames with the page reference string as follows:0,1,2,3,0,1,4,0,1,2,3,7Find the number of page hits in FIFO Replacement Policy.
Consider main memory with a total of 2 blocks. LRU replacement policy is used for choosing the block to be replaced. The number of faults for the following sequence of block addresses 8, 12, 0, 12, 8 is _____________4635
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.