in CO and Architecture edited by
403 views
0 votes
0 votes
Consider an array has 100 elements and each element occupies 4 words .A 32 word cache is used and divided into a block of 8 words .What is the hit ratio for this  statement
for(i=0; i<100; i++)
         A[i] = A[i]+10;

I just want to ask that whenever a cache miss occur, consecutive 8 words ,( ie 2 elements) are fetched and placed in cache,so why we are doing like this is it because we have to follow law of spatial locality ?
in CO and Architecture edited by
403 views

5 Comments

Yes
Since a block size is 8B, and we fill 1 block completely so we put 2 elements at a time
0
0
@manisha can you explain your point that why it is so?
0
0
@manisha how to approach these question i am not getting it
0
0

@Shivani gaikawad

from Main Memory to Cache we transfers blocks, he doesn't specify how many no.of blocks are transferred at a time when a cache miss( spatial locality ), we take 1 block ( by default ).

0
0

@Shivani gaikawad
Shaikh explained it well, hope it is clear now.

0
0

Please log in or register to answer this question.

Related questions