GATE | GATE CS Mock 2018 | Question 50
Consider an array A & 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
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
Level Up Your GATE Prep!
Embark on a transformative journey towards GATE success by choosing Data Science & AI
as your second paper choice with our specialized course. If you find yourself lost in the vast landscape of the GATE syllabus, our program is the compass you need.