0
1.1kviews
Explain page replacement algorithm & find out page fault for following string using LRU method.6,0,12,0,30,4,2,30,32,1,20,15(Consider page frame size=3)
1 Answer
0
10views

LRU Page Replacement Policy

  • LRU stands for Least Recently Used page replacement strategy.
  • This algorithm works on the principle of “Last in First out“.
  • It replaces the newest page that arrived at last in the main memory.
  • It replaces the page that has not been referred by the CPU for the longest time.
  • It is implemented by keeping track of all the pages in a stack.
  • This strategy helps OS to find page usage over a short period of time.
  • This policy should be implemented by associating a counter with an even page.
  • Page, which has not been used for the longest time in the main memory, is the one that will be selected for replacement.
  • Easy to implement, keep a list, replace pages by looking back into time.

Example:

String = 6, 0, 12, 0, 30, 4, 2, 30, 32, 1, 20,15

Frame Size = 3

String 6 0 12 0 30 4 2 30 32 1 20 15
Frame 3 12 12 4 4 32 32 32 15
Frame 2 0 0 0 0 2 2 1 1 1
Frame 1 6 6 6 30 30 30 30 30 20 20
Miss/Hit M M M H M M M H M M M M

Page Fault = 10

Please log in to add an answer.