retagged by
6,550 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

915
views
1 answers
0 votes
Na462 asked Jul 29, 2018
915 views
Assume that we have a two dimensional array of 60 × 60. Each element is of 4 bytes and array is stored in row major order. RAM is 2 MB and cache is 8 KB with each block ...
1.3k
views
1 answers
4 votes
Xylene asked Aug 6, 2017
1,309 views
I read that if block size increases, then we have fewer blocks so number of conflict misses increases.My doubt is how will the conflict misses increase ? If cache size is...
512
views
1 answers
0 votes
S Ram asked Jan 12, 2019
512 views
Can we apply LRU policy to direct mapped cache. according to me it doesn't make any sense as eventually it will be like FIFO only as unique memory addresses are assigned ...
691
views
0 answers
0 votes
Ashwani Yadav asked Dec 20, 2018
691 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 ...