page-replacement

Is it possible for a FIFO page-replacement strategy to outperform LRU?

牧云@^-^@ 提交于 2019-12-12 19:17:24
问题 As part of my operating systems homework, I was asked to compare the number of page faults produced by first-in-first-out and least-recently-used page-replacement strategies for a given sequence of page accesses. Perplexingly, it appears that FIFO produced fewer page faults than LRU. Is this possible, or have I made a mistake? 回答1: Yes, it's possible for FIFO to beat LRU. The smallest example I can think of, Cache size: 2 pages. Access pattern: A, B, A, C After that, the LRU cache contains "A

LRU Page Replacement algorithm C#

余生长醉 提交于 2019-12-08 05:48:03
问题 I am trying to write a function which simulates LRU page replacement. I understand LRU pretty well but am having problems coding it. The following things are being passed into the LRU function. The user specifies the 20 character reference string of #'s 1-9 which is stored in an array called refString of size 20. The number of frames the user enters (1-7) is stored in a variable numFrames. Finally, an array of size 7 called frame is passed in. Here is the code I have, and I am getting a close