The Gateway to Computer Science Excellence
0 votes
206 views
In LRU policy for cache replacement. the least recently used block is replaced. So, what happens when all the slots are empty at beginning?

Is LRU or MRU easier to implement? Why?
in Revision by Veteran (425k points) | 206 views
0

Replacement policy are used when all the positions that a new block may occupy in a cache are full or occupied by old blocks . As in question cache slots are empty so in beginning there is no need of replacement policy  and if need arises after some blocks are brought into cache than LRU is easier to implement because it choose the best block to be removed which is least recently used.( I tried is it right ,Sir ).

1 Answer

0 votes
No need for replacement initially as they are already empty. we see replacement when the memory is full. And the second one i think both are of same cost in implementation. just a guess.
by Boss (16k points)
0
yes, first part is correct and I guess if asked like this most people get it right. But it created a lot of confusion for the 2014 GATE question.

For the second part, which requires more storage- LRU or MRU?
0
Sir, Is MRU easier to implement? I just guess so because extra Data Structure is needed in LRU. But in MRU, last block placed is to be replaced.
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,644 questions
56,503 answers
195,553 comments
101,036 users