FIFO页面替换如何工作?

tem*_*ame 4 operating-system page-replacement

我正在尝试理解FIFO页面替换算法,但我能找到的所有信息都等于下面的内容.您能否使用FIFO的特定示例来解释如何使用引用字符串来评估页面替换算法?

必须更换页面时,会选择最旧的页面.

在我们的所有示例中,引用字符串是

1,2,3,4,1,2,5,1,2,3,4,5

3帧(9页故障)4帧(10页故障)

Ban*_*cat 9

页面错误是指内存帧中不存在页面,因此必须将陷阱发送到OS,并且必须将页面添加到帧中.如果没有房间,那么需要删除一些东西.FIFO是一种确定将删除哪个页面的方法.

这个概念是首先添加到框架中的任何页面都将被删除.这就是FIFO的意思.用你的第一个例子.我将沿着参考字符串列表向下显示内存的外观.

1:  1      +1 fault
2:  1,2    +1 fault
3:  1,2,3  +1 fault
4:  2,3,4  +1 fault - 1 gets removed because it was the first added
1:  3,4,1  +1 fault - 2 gets removed because it was the first on the list
2:  4,1,2  +1 fault - 3 got removed..
5:  1,2,5  +1 fault - 4 got removed..
1:  1,2,5  No change - 1 is already present so no page fault was required
2:  1,2,5  No change - 2 is already present in the frame
3:  2,5,3  +1 fault - 1 was removed because it is first
4:  5,3,4  +1 fault - Now 2 got removed
5:  5,3,4  No change - No change because 5 is present in one of the frames.
Run Code Online (Sandbox Code Playgroud)

这给出了总共9个故障.

您也可以将其视为最旧的页面被删除.

希望我没有犯错:D


Jar*_*ger 5

------------*首先出现*-------------

Page no. 1 |   1 +1

Page no. 2 |   1 2 +1

Page no. 3 |   1 2 3 +1

Page no. 4 |   1 2 3 4 +1

Page no. 1 |  

Page no. 2 |  

Page no. 5 |   2 3 4 5 +1

Page no. 1 |   3 4 5 1 +1

Page no. 2 |   4 5 1 2 +1

Page no. 3 |   5 1 2 3 +1

Page no. 4 |   1 2 3 4 +1

Page no. 5 |   2 3 4 5 +1


Page Faults = 10
Run Code Online (Sandbox Code Playgroud)


小智 3

当队列中不可用时,页面将被替换。

转到此链接先进先出

这里解释了所有页面替换算法。很好的例子。你很容易明白。