我正在尝试理解FIFO页面替换算法,但我能找到的所有信息都等于下面的内容。您能否使用FIFO的特定示例来解释如何使用引用字符串来评估页面替换算法?
当必须更换页面时,会选择最旧的页面。
在我们的所有示例中,引用字符串是
1,2,3,4,1,2,5,1,2,3,4,5
3帧(9页故障) 4帧(10页错误)
答案 0 :(得分:8)
页面错误是指内存帧中不存在页面,因此必须将陷阱发送到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.
这给出了总共9个故障。
您也可以将其视为最旧的页面被移除。
希望我没有犯错:D
答案 1 :(得分: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
答案 2 :(得分:3)
答案 3 :(得分:-2)
CREATE PROCEDURE [dbo].[upd_facility_new] @Tcifno int