Download presentation
Presentation is loading. Please wait.
1
Module IV Memory Organization
2
LFU Page Replacement Algorithm
It involves keeping track of the number of times a page is referenced in memory. Implementation: Assign a counter to every block that is loaded into the cache. Each time a reference is made the counter is incremented When the cache reaches capacity, system will search for the page with lowest counter and remove it from the cache
3
LFU Page Replacement Example Consider the reference string :
7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1 for a memory with three frames.
4
7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1 Page Frame Hit -1 7 7(1)
5
7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1 Page Frame Hit -1 7 7(1) 0(1)
6
7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1 Page Frame Hit -1 7 7(1) 0(1) 1 1(1)
7
7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1 Page Frame Hit -1 7 7(1) 0(1) 1 1(1) 2 2(1)
8
7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1 Page Frame Hit -1 7 7(1) 0(1) 1 1(1) 2 2(1) 0(2)
9
7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1 Page Frame Hit -1 7 7(1) 0(1) 1 1(1) 2 2(1) 0(2) 3 3(1)
10
7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1 Page Frame Hit -1 7 7(1) 0(1) 1 1(1) 2 2(1) 0(2) 3 3(1) 0(3)
11
7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1 Page Frame Hit -1 7 7(1) 0(1) 1 1(1) 2 2(1) 0(2) 3 3(1) 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2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1 Page Frame Hit -1 7 7(1) 0(1) 1 1(1) 2 2(1) 0(2) 3 3(1) 0(3) 4 4(1) 0(4) 3(2) Page Frame Hit -1 2 3(2) 0(4) 2(2) 1 1(1) 2(3) 0(5)
20
7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1 Page Frame Hit -1 7 7(1) 0(1) 1 1(1) 2 2(1) 0(2) 3 3(1) 0(3) 4 4(1) 0(4) 3(2) Page Frame Hit -1 2 3(2) 0(4) 2(2) 1 1(1) 2(3) 0(5) 1(2)
21
7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1 Page Frame Hit -1 7 7(1) 0(1) 1 1(1) 2 2(1) 0(2) 3 3(1) 0(3) 4 4(1) 0(4) 3(2) Page Frame Hit -1 2 3(2) 0(4) 2(2) 1 1(1) 2(3) 0(5) 1(2) 7 7(1)
22
7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1 Page Frame Hit -1 7 7(1) 0(1) 1 1(1) 2 2(1) 0(2) 3 3(1) 0(3) 4 4(1) 0(4) 3(2) Page Frame Hit -1 2 3(2) 0(4) 2(2) 1 1(1) 2(3) 0(5) 1(2) 7 7(1) 0(6)
23
7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1 Page Frame Hit -1 7 7(1) 0(1) 1 1(1) 2 2(1) 0(2) 3 3(1) 0(3) 4 4(1) 0(4) 3(2) Page Frame Hit -1 2 3(2) 0(4) 2(2) 1 1(1) 2(3) 0(5) 1(2) 7 7(1) 0(6) Hit Ratio = 9/20 No. of Page Faults = 11
24
7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1 Page Frame Hit -1 7 7(1) 0(1) 1 1(1) 2 2(1) 0(2) 3 3(1) 0(3) 4 4(1) 0(4) 3(2) Page Frame Hit -1 2 3(2) 0(4) 2(2) 1 1(1) 2(3) 0(5) 1(2) 7 7(1) 0(6) Hit Ratio = 9/20 No. of Page Faults = 11
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.