Last Updated : 19 Nov, 2018

Consider an array A[999] & each element occupies 4 word. A 32 word cache is used and divided into 16 word blocks. What is the miss ratio for the following statement. Assume one block is read into cache in case of miss:

for(i=0; i < 1000; i++)
  A[i] = A[i] + 99

(A) 0.50
(B) 0.75
(C) 0.875
(D) 0.125


Answer: (D)

Explanation: Since there is 16 word block, 4 element can stay in one block. Now notice that each element is referred twice, one read and one write operation.
So when in a block when 1st element is referred for read, it will be miss, and hence that block will be copied to cache.
Now 2nd, 3rd, and 4th references to that 1st element will be hit for read and write. So out of 8 reference, 1 miss and 7 hit for one block. Gets repeated for each and every block.
Therefore, hit 7/8 and miss 1/8

Option (D) is correct.

Quiz of this Question


Share your thoughts in the comments