The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+1 vote
40 views
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
asked in Operating System by (35 points) | 40 views

1 Answer

+2 votes

Cache Memory has 4 sets and each set contain 2 lines. 
To map main memory block to cache we are going to use Kmod4
0 - Miss - Mapped to set 0
5 - Miss - Mapped to set 1
3 - Miss - Mapped to set 3
9 - Miss - Mapped to set 1
7 - Miss - Mapped to set 3
0  - Hit
16 - Miss -  Mapped to set 0
55 - Miss - Mapped to set 3 ( since LRU is used we are going to replace 3)

Set 0 0
16
Set 1 5
9
Set 2  
 
Set 3 3 replaced by 55
7

So following memory block will be present at the end : 0,16,5.9,55,7

answered by Boss (6.6k points)
correct


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

29,006 questions
36,838 answers
91,329 comments
34,718 users