Open In App

GATE | GATE-IT-2004 | Question 48

Like Article
Like
Save
Share
Report

Consider a fully associative cache with 8 cache blocks (numbered 0-7) and the following sequence of memory block requests:

4, 3, 25, 8, 19, 6, 25, 8, 16, 35, 45, 22, 8, 3, 16, 25, 7

If LRU replacement policy is used, which cache block will have memory block 7?

 
(A) 4
(B) 5
(C) 6
(D) 7


Answer: (B)

Explanation: Block size is =8

Given 4, 3, 25, 8, 19, 6, 25, 8, 16, 35, 45, 22, 8, 3, 16, 25, 7

So from 0 to 7 ,we have

  • 4 3 25 8 19 6 16 35    //25,8 LRU so next 16,35 come in the block.
  •  45 3 25 8 19 6 16 35
  • 45 22 25 8 19 6 16 35
  • 45 22 25 8 19 6 16 35
  • 45 22 25 8 3 6 16 35     //16 and 25 already there
  • 45 22 25 8 3 7 16 35   //7 in 5th block

    Therefore , answer is  B


Quiz of this Question


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads