0

I am just only learning about paging and was wondering if what I did for my page replacements was correct as the tutorials I found online seem a bit all over the place. I am mostly seeking clarification on whether I've done anything wrong and would like an explanation instead of a direct link to something elsewhere I have to further interpret things which don't really help.

I've done one with 3 frames of memory for the sequence, 0, 3, 1, 2, 3, 2, 0, 1, 0, 1, 3, 0, 2, 3, 1

Screenshot of my working

Y = there was a fault and N = No fault.

UPDATE:Tried fixing my FIFO, new working for FIFO

Kyle
  • 69
  • 6
  • Your lru is correct. Your fifo appears to be exactly same as lru, why? When the second zero comes (#7) the frames were 3, 1 and 2. When you removed page 1, it was correct by lru but NOT by fifo. In fifo, you should have removed page 3. See page 1 is introduced in step #3 so it is younger than page 3 which was introduced in step #2. Page 2 is youngest having introduced in step #4. In fifo, replace oldest, ie. page 3. In lru replace oldest-untouched. – inquisitive Feb 14 '17 at 15:59
  • @inquisitive So I've done the FIFO again, not entirely sure if I am correct this time around. – Kyle Feb 14 '17 at 16:46
  • 1
    In fifo, replace oldest. Check step #11. Page 3 is competing against page 1 (#3), page 2 (#4) and page 0 (#7). Why did you remove page 0 when you should be removing page 1? – inquisitive Feb 14 '17 at 17:11

2 Answers2

0

sequence of steps for fifo operation

While doing fifo, in each step, we copy the previous cache state. Note that the cache slots are from left to right by oldest to youngest. Depending on hit or miss, we do one of the two things:

If hit then do nothing.

If miss then, delete the leftmost cache entry. Append new entry to the right.

While doing lru, everything remains same except that when hit, we move the hit item to the rightmost slot. This means the item hit becomes the youngest among its peers.

inquisitive
  • 3,549
  • 2
  • 21
  • 47
-2

FIFO page replacement algorithm in 2mints bangla! https://www.youtube.com/watch?v=QuucGuHkLcI&t=9s