Definition
Memory Locality
Memory locality is the property that the memory accesses of a program are not spread uniformly over all addresses, but tend to cluster.
After accessing some location, a program is likely either to access the same location again soon or to access nearby locations soon. This is what the memory system exploits to make memory accesses fast.
The two main forms of memory locality are temporal memory locality and spatial memory locality.
Forms
Temporal
Definition
Link to originalTemporal Memory Locality
Temporal memory locality is the property that if a program has accessed a memory location recently, then it is likely to access the same location again in the near future.
A memory system exploits temporal locality by keeping recently accessed data in faster levels of the memory hierarchy, such as a cache.
Spatial
Definition
Link to originalSpatial Memory Locality
Spatial memory locality is the property that if a program has accessed a memory location, then it is likely to access nearby locations soon as well.
A memory system exploits spatial locality by fetching neighbouring data together into faster levels of the memory hierarchy, for example into a cache.