页替换算法 - LRU [英] Page replacement algorithm - LRU
问题描述
我正在尝试使用这个 youtube 视频自学 LRU 算法.在下面的示例中(取自此处)为什么是 0替换为 3.不应该将 4 替换为 3,因为 4 是最少使用的吗?
I am trying to teach myself LRU algorithm using this youtube video. In the below example (taken from here) why is 0 replaced by 3. Shouldn't that be 4 replaced by 3 as 4 is the least used ?
推荐答案
LRU 代表Least Recently Used".它基于利用参考的时间局部性",即在一段时间内会使用相同的东西.
LRU stands for "Least Recently Used". It's based on taking advantage of "temporal locality" of reference, i.e. the thought that the same stuff will be used in a period of time.
在您的情况下,在当前访问之前的过去 3 次访问是 0 - 4 - 2.这意味着在物理内存中的页面中,0 是最近最少使用的页面,因此它会被分页.
In your case, the past three accesses before the current one were 0 - 4 - 2. This means that of the pages in physical memory, 0 was the least recently used, and so it gets paged out.
这篇关于页替换算法 - LRU的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!