search
Log In
0 votes
242 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 242 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.
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.

Related questions

3 votes
1 answer
1
164 views
Self doubt: What is the rule or keyb point we should keep in mind while solving problems on LRU page replacement algorithm? Please explain with examples.
asked Jan 18, 2018 in Operating System Sona Barman 164 views
1 vote
0 answers
2
176 views
if you have 10 Frames and using LRU how many page fault will be there in both below: for (int j = 0; j < 100; j++) for (int i = 0; i < 100; i++) A[i][j] = A[i][j] + A[j][i]; for (int i = 0; i < 100; i++) for (int j = 0; j < 100; j++) A[i][j] = A[i][j] + A[j][i];
asked Nov 13, 2017 in Operating System ashu0316 176 views
0 votes
1 answer
3
178 views
" In the case of LRU, ( and particularly the stack implementation thereof ), the top N pages of the stack will be the same for all frame set sizes of N or anything larger." Can somebody please explain what this means? Please refer : https://www.cs.uic.edu/~jbell/CourseNotes/OperatingSystems/9_VirtualMemory.html
asked Aug 25, 2017 in Operating System Warlock lord 178 views
0 votes
0 answers
4
142 views asked Jan 25, 2017 in CO and Architecture debanjan sarkar 142 views
...