Content deleted Content added
clean out apparent COI / refspam |
mNo edit summary |
||
(18 intermediate revisions by 18 users not shown) | |||
Line 1:
{{Short description|
{{more citations needed|date=July 2008}}
In [[computer science]], '''locality of reference''', also known as the '''principle of locality''',<ref>Not to be confused with the [[principle of locality]] o=s*v=411##sts in physics.</ref> is the tendency of a processor to access the same set of memory locations repetitively over a short period of time.<ref>{{Cite book|title=Computer organization and architecture : designing for performance|last=William.|first=Stallings|date=2010|publisher=Prentice Hall|isbn=9780136073734|edition= 8th|___location=Upper Saddle River, NJ|oclc=268788976}}</ref> There are two basic types of reference locality {{
Locality is a type of [[predictability|predictable]] behavior that occurs in computer systems. Systems
== Types of locality ==
Line 43:
Typical memory hierarchy (access times and cache sizes are approximations of typical values used {{As of|2013|lc=on}} for the purpose of discussion; actual values and actual numbers of levels in the hierarchy vary):
* [[CPU register]]s (8–256 registers) – immediate access, with the speed of the innermost core of the processor
* L1 [[CPU cache]]s (32
* L2 CPU caches (128
* L3 CPU caches (2
* Main [[physical memory]] ([[random-access memory|RAM]]) (256
* Disk ([[virtual memory]], [[file system]]) (1
* Remote memory (other computers or the cloud) (practically unlimited) – speed varies from very slow to extremely slow
Line 96:
On a year 2014 processor, the second case is approximately five times faster than the first case, when written in [[C (programming language)|C]] and compiled with <code>gcc -O3</code>. (A careful examination of the disassembled code shows that in the first case, [[GNU Compiler Collection|GCC]] uses [[SIMD]] instructions and in the second case it does not, but the cache penalty is much worse than the SIMD gain.){{Citation needed|date=September 2014}}
Temporal locality can also be improved in the above example by using a technique called [[Loop blocking|blocking]]. The larger matrix can be divided into evenly sized sub-matrices, so that the smaller blocks can be referenced (multiplied) several times while in memory. Note that this example works for square matrices of dimensions SIZE x SIZE, but it can easily be extended for arbitrary matrices by substituting SIZE_I, SIZE_J and SIZE_K where appropriate.
<syntaxhighlight lang="pascal" line="1">
Line 124:
* [[Scratchpad memory]]
* [[Working set]]
* [[Heuristic]]
* [[Locality-sensitive hashing]]
== References ==
Line 130 ⟶ 132:
== Bibliography ==
* [[Peter J. Denning]], [http://denninginstitute.com/pjd/PUBS/CACMcols/cacmJul05.pdf "The Locality Principle"], ''Communications of the ACM'', Volume 48, Issue 7, (2005), Pages 19–24
* Peter J. Denning, Stuart C. Schwartz, [http://denninginstitute.com/pjd/PUBS/WSProp_1972.pdf "Properties of the Working-Set Model"], ''Communications of the ACM'', Volume 15, Issue 3 (March 1972), Pages
{{DEFAULTSORT:Locality Of Reference}}
|