GATE - 2005 | OS | Consider a 2-way set associative cache memory with 4 sets and total

GATE - 2005 | OS | Consider a 2-way set associative cache memory with 4 sets and total
Posted on 19-02-2022

GATE - 2005 [Operating System]

Question:

Consider a 2-way set associative cache memory with 4 sets and total 8 cache blocks (0-7) and a main memory with 128 blocks (0-127). What memory blocks will be present in the cache after the following sequence of memory block references if LRU policy is used for cache block replacement. Assuming that initially the cache did not have any memory block from the current job? 0 5 3 9 7 0 16 55

A

0 3 5 7 16 55

B

0 3 5 7 9 16 55

C

0 5 7 9 16 55

D

3 5 7 9 16 55

     

Solution:

Option (C) is Correct.

The cache is 2-way associative, so in a set, there can be 2 block present at a time.
So,

Consider a 2-way set associative cache memory with 4 sets and total 8 cache blocks (0-7) and a main memory with 128 blocks (0-127). What memory blocks will be present in the cache after the following sequence of memory block references if LRU policy is used for cache block replacement. Assuming that initially the cache did not have any memory block from the current job? 0 5 3 9 7 0 16 55

Since, each set has only 2 places, 3 will be thrown out as its the least recently used block. So final content of cache will be
0 5 7 9 16 55
Hence, answer is (C).

Thank You

Download App for Free PDF Download

GovtVacancy.Net Android App: Download

government vacancy govt job sarkari naukri android application google play store https://play.google.com/store/apps/details?id=xyz.appmaker.juptmh