Redirected
retagged by
6,222 views
12 votes
12 votes

Consider a cache as follows:

  • Direct mapped
  • 8 words total cache data size
  • 2 words block size


A sequence of eight memory read is performed in the order shown from the following  addresses:

0 , 11 , 4 , 14 , 9 , 1 , 8 , 0

Calculate

  1. No. of misses
  2. No of compulsory misses
  3. No. of conflict misses
  4. No. of capacity misses
retagged by

3 Answers

Best answer
12 votes
12 votes

Total cache size is 4 blocks.

Memory accesses are as follows: 0 , 11 , 4 , 14 , 9 , 1 , 8 , 0

So, the corresponding block numbers will be: 0, 5, 2, 7, 4, 0, 4, 0 (000, 101, 010, 111, 100, 000, 100, 000)

0, 5, 2, 7 and 4 causes compulsory misses as they are first accesses to blocks.

Next 0 is a capacity miss as after the previous access to 0, we have 4 unique block accesses and we have capacity only for $4-1=3$ more. Being a capacitive miss it cannot be a conflict miss (Conflict miss is a miss which won't happen in a fully associative cache with LRU policy)

Next 4 is a conflict miss due to 0 replacing 4 but not a capacity miss.

Similarly final 0 is also a conflict miss but not capacity miss.

No. of misses = 8

No. of compulsory misses = 5

No. of conflict misses = 2

No. of capacity misses = 1

More Explanation: https://gateoverflow.in/20086/page-replacement

edited by
1 votes
1 votes

As Per me, i solved in this way
If im wrong Please someone explain where im missing

#cache line= 8/2 = 2 lines

each line can hold 2 words

to find which line the block can be stored
x mod n is used 
where x is block number
n is number of lines

0 --- 0 mod 4 = 0  
11 --- 11 mod 4 = 3  
4 --- 4 mod 4 = 0  
14 --- 14 mod 4 = 2  
9 --- 9 mod 4 = 1  
1 --- 1 mod 4 = 1  
8 --- 8 mod 4 = 0  
0 --- 0 mod 4 = 0  

As each line can hold 2 words 0,4 are placed in 0 later 0 is replaced with 8 and 4 is replaced with 0

No.of misses =8

compulsory miss =6 (0,11,4,14,9,1)

conflict misses =2 (8,0)

capacity miss =0

Related questions

0 votes
0 votes
1 answer
1
0 votes
0 votes
1 answer
3
0 votes
0 votes
0 answers
4
Ashwani Yadav asked Dec 20, 2018
616 views
what’s the answer here ...unable to understand their solution.and also shouldn’t be the reason like this For R to be true: “ A unique cache page is associated with ...