Studying LRU approximation Algorithms I think to have not understand how it works, for example:
consider a process with 3 logical pages and 2 frames allocated , an approximation of the
Algorithm Last Recently Used based of reference bits where every four references there is
a shift and where are considered just the first 2 bits, and the follow reference string:
1 2 1 1 1 1 0 1 0 0
I'd solve it in this way:
1 2 1 1 (m1) 1 1 (m2) 0 1 0 0
(m1)
4 references so I'd pass from
frame frame
-----+---+--- to -----+---+---
1 | 1 | 0 1 | 0 | 1
2 | 1 | 0 2 | 0 | 1
(m2)
page fault so I'd pass from
frame frame
-----+---+--- to -----+---+---
1 | 1 | 1 1 | 0 | 0
2 | 0 | 1 0 | 0 | 0
So the questions are:
- Is my doing correct?
- At m2 there is a page fault, is there a "reset" and all bits puts at 0?
- the shift frequency (4 in the example) restart counting every page fault?
