Locality of reference
Encyclopedia : L : LO : LOC : Locality of reference
- redirect [[Template:Not verified]]
- Temporal locality
- The concept that a resource that is referenced at one point in time will be referenced again sometime in the near future.
- Spatial locality
- The concept that likelihood of referencing a resource is higher if a resource near it was just referenced.
- Sequential locality
- The concept that memory is accessed sequentially.
Increasing and exploiting locality of reference are common techniques for optimization. This can happen on several levels of the memory hierarchy. Paging obviously benefits from spatial locality. A cache is a simple example of exploiting temporal locality, because it is a specially designed faster but smaller memory area, generally used to keep recently referenced data and data near recently referenced data, which can lead to potential performance increases. Data in cache does not necessarily correspond to data that is spatially close in main memory; however, data elements are brought into cache one cache line at a time. This means that spatial locality is again important: if one element is referenced, a few neighbouring elements will also be brought into cache. Finally, temporal locality plays a role on the lowest level, since results that are referenced very closely together can be kept in the machine registers. Programming languages such as C allow the programmer to suggest that certain variables are kept in registers.
References
See also
From Wikipedia, the Free Encyclopedia. Original article here. Support Wikipedia by contributing or donating.
All text is available under the terms of the GNU Free Documentation License See Wikipedia Copyrights for details.
