CameraIcon
CameraIcon
SearchIcon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
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 9 16 55
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
3 5 7 9 16 55
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
0 5 7 9 16 55
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
D
0 3 5 7 16 55
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is C 0 5 7 9 16 55
Number of bits requires for 128 main
memory block

=log2(!28)
=7 bits

Main memory format:


Since main memory and cache memory offset will be same.

Number of bits for set=log2(4)=2

So, cache memory format will be:



So, each set can maps 32 blocks and at one time can hold only 2 different block


So, for block 55, block 3 will be replaced since 3 is come before block 7.

So, memory block 0, 5, 7, 9, 16 and 55 will be present in cache.

flag
Suggest Corrections
thumbs-up
0
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Enter Arabs
HISTORY
Watch in App
Join BYJU'S Learning Program
CrossIcon