任何人都可以为LRU和LFU提供两个例子吗?
1.bad for LRU and good for LFU
2.对于LRU而言是好的而对LFU来说是不好的?
答案 0 :(得分:1)
LRU糟糕的LFU好
LRU好LFU不好
让我们考虑该示例的修改版本:
A, B, C, A, A, A, A, B, B, B, B, C, D, C
使用LRU我们会得到类似的东西:
[A]
[A, B]
[A, B, C]
[B, C, A] <- a stream of As keeps A at the head of the list.
[C, A, B] <- a stream of Bs keeps B at the head of the list.
[A, B, C]
[B, C, D] <- here, we evict A
[B, C, D]
[B, D, C]
然而,对于LFU,我们会保留A和B,这会导致驱逐C和D,这可以在这里看到:
[A]
[A, B]
[A, B, C]
[A, B, C] <- a stream of As makes the frequency of A = 5
[A, B, C] <- a stream of Bs makes the frequency of B = 5
[A, B, C] <- C = 2
[A, B, D] <- here, we evict C because it has the lowest frequency
[A, B, C] <- here, we evict D because it has the lowest frequency
与LRU相比,我们最终用LFU驱逐C和D,我们保留了D和C
答案 1 :(得分:0)
&#34;最少使用&#34;是os中页面替换的最佳多边形 !!!
LRU(最近使用的最少): CPU将分配的过程将是哪一个 最近最少使用,在活动进程队列中。
LFU(最少使用): CPU将分配的过程将是哪一个 在活动进程队列中使用最少。
答案 2 :(得分:0)