Take the 2-minute tour ×
Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. It's 100% free, no registration required.

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?
share|improve this question

1 Answer 1

Is my doing correct?

If I don't misunderstand your notation, when you manipulate the frame for first time (filling it with page 1, then page 2) and then page 1 is called again, you shouldn't send to disk page 2, there is no need because page 1 it is already in frame.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.