181k views
1 vote
For 3 page frames, the following is the reference string :

7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1
i) How many page faults does the LRU page replacement algorithm produce ?
a) 10
b) 15
c) 11
d) 12

1 Answer

3 votes

Final answer:

Using the LRU algorithm for the given 3 page frames and reference string, we count a total of 12 page faults. The correct answer to how many page faults this algorithm produces is d) 12.

Step-by-step explanation:

The question revolves around the concept of page replacement algorithms used in operating systems, specifically focusing on the Least Recently Used (LRU) algorithm. Given 3 page frames and a reference string, we are asked to determine the number of page faults incurred using LRU page replacement.

  1. Start with empty page frames: [ ]
  2. Place 7, results in page fault: [7]
  3. Place 0, results in page fault: [7, 0]
  4. Place 1, results in page fault: [7, 0, 1]
  5. No change for 2, results in page fault: [2, 0, 1]
  6. No change for 0, no page fault
  7. Place 3, results in page fault: [2, 3, 0]
  8. Place 0, no page fault
  9. Place 4, results in page fault: [2, 3, 4]
  10. No change for 2, results in page fault: [2, 3, 4]
  11. Place 3, no page fault
  12. Place 0, results in page fault: [0, 3, 2]
  13. Place 3, no page fault
  14. Place 2, no page fault
  15. Place 1, results in page fault: [0, 3, 1]
  16. Place 2, results in page fault: [0, 2, 1]
  17. Place 0, no page fault
  18. Place 1, no page fault
  19. Place 7, results in page fault: [7, 2, 1]
  20. Place 0, results in page fault: [7, 0, 1]
  21. Place 1, no page fault

Counting the page faults, we get a total of 12. Therefore, the correct answer is d) 12.

.

User Richard Sayakanit
by
8.0k points