368 views
0 votes
0 votes
Computer uses a fully associative write-back data cache
Block size is 64 bytes,

Consider following code,

for(i=1;i<1024;i++)    {
              x[i] = b[i] * y;    // S1
              c[i] = x[i] + z;    // S2
            }

Assume x[1024], b[1024] and c[1024] are all double precision floating point arrays with arrays b and c already in cache,
moving x into the cache does not conflict with b or c
x[0] is stored at the beginning of a block

1)how many misses arise with respect to accessing x if the cache uses a no-write allocate policy?(Ans :256)
2)how many misses arise with respect to accessing x if the cache uses a write allocate policy?(Ans :128)

Are the answers correct?

Since the cache is write back first x[i] (S1) is write miss and second read miss will happen because of no write-allocate policy.

But on read miss ,block will be brought in, for other 7 elements it will be hit,so 2 misses for 1 block

Number of blocks=(1024*8)/64=128 hence 2*128=256 misses.

Am I  wrong somewhere?

Please log in or register to answer this question.