Cache Memory / Spatial locality of reference

Hardware cache memories exploit spatial locality of reference :

(a) by remembering which pieces of data have been accessed recently

(b) when data items are re-accessed frequently

(c) by remembering which cache blocks (lines) have been written to

(d) only if cache block (line) size is greater than 1 byte

Vivek Vikram Singh @vivek14 12 Jun 2016 02:18 pm

The easy way to understand and remember locality of reference is Spatial is for Space and temporal for time.

A) It tells about time.

B) Same as A.

C) It does not remember the lines which are written only.

Suppose you read byte number 5, which also is cache line number 5, if only one byte is in one cache line. Spatial locality says nearby bytes of accessed data is likely to be accessed next. Now there is NO bytes in cache line number 5 which can be cached to get the benefit of locality. Had it been more than 1 byte, say 2 or 3, you would have copied that whole cache line and next accessed byte, say number 6 or 7 would have been in cache, getting the benefit of spatial locality.

Sourav Mishra @sourav 12 Jun 2016 02:20 pm

Thnx, for clarifying my doubt once and for all.

Lovely @cse23 14 Jun 2016 02:10 pm

answer is both a and b???

Sourav Mishra @sourav 14 Jun 2016 08:07 pm


Hradesh @hradeshpatel 14 Jun 2016 08:13 pm

yes D is correct answer bcoz it,s dependent on space..

 option A  and B is dependent on time ..(recently accessed)

  option C does not remembering

Sourav Mishra @sourav 14 Jun 2016 08:19 pm