GATE | Sudo GATE 2020 Mock II (10 January 2019) | Question 50

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.125
(B) 0.875
(C) 0.75
(D) 0.50


Answer: (A)

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 (A) is correct.

Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.