Principle of Locality

alpharithms fallback 1

The principle of locality, also known as locality of reference, states that a computer program will only require access to a very small percentage of the overall memory space at any single instant during execution.

Leveraging this concept supports engineers and programmers in designing systems optimized memory access resulting in better overall performance. The principle of locality can be further characterized by the following types of locality:

Temporal locality – memory that is accessed once tends to be accessed again soon thereafter. An example would be an iterator variable (loop variable) within a loop. It is accessed during each iteration.

Spatial locality – items whose addresses are near that of an accessed item’s address tend to be referenced soon. An example would be elements within an array structure. In many cases, accessing the first element of an array directly precedes the access of the next element.

The principle of locality, and its resulting sub-characterizations, are common foundational concepts used in the design of such systems as Cache memory.

Zαck West
BSc Computer Science, BSc Technology Education. Life-long learner and entrepreneur specializing in design, digital marketing, and web app development. Fascinated by natural systems, concurrency, and the nature of consciousness.