CameraIcon
CameraIcon
SearchIcon
MyQuestionIcon
MyQuestionIcon
3
You visited us 3 times! Enjoying our articles? Unlock Full Access!
Question

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
6
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
4
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
7
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
5
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
Open in App
Solution

The correct option is D 5
Fully associate cache with 8 block i.e. 1 set with 8 cache blocks.

Set
4 3 25 8 19 6 25 16
B0 B1 B2 B3 B4 B5 B6 B7

Since set contain 8 blocks so, request for 45 replacement is needed. When 45 comes then
454 3 25 8 19 6 25 16
B0 B1 B2 B3 B4 B5 B6 B7

For request 22 :
45 223 25 8 19 6 25 16
B0 B1 B2 B3 B4 B5 B6 B7

For request 8. Since already present, so no replacement.

For request 3:
45 22 25 8 319 6 25 16
B0 B1 B2 B3 B4 B5 B6 B7

For request 16: since already present, so no replacement.
For request 25; since already present, so no replacement.
For request 7:
4 3 25 8 19 76 25 16
B0 B1 B2 B3 B4 B5 B6 B7

So block 5 i.e. B5 contain memory block 7.

flag
Suggest Corrections
thumbs-up
1
similar_icon
Similar questions
View More
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Demand Paging
OTHER
Watch in App
Join BYJU'S Learning Program
CrossIcon