Locality – Virtual Memory

By | October 27, 2021


Central to most memory management techniques is the concept of locality – that processes tend to reference storage in nonuniform, highly localized patterns.

Locality exhibit itself in two forms: 

  1. Temporal locality
  2. Spatial locality

1. Temporal Locality

Temporal locality means that storage locations referenced recently are likely to be referenced in the near future.

Locality - Virtual Memory

For example, if the weather is sunny at 3 p.m., then there is a good chance that the weather was sunny at 2:30 pm, and will be sunny at 3:30 pm. The various concepts supporting this observation are looping, subroutines, stacks and variables used for counting and totaling.

2. Spatial locality

Spatial locality means that storage references tends to be clustered so that once a location is referenced, it is highly likely that nearly locations will be referenced.

For example, if it is sunny in one town, then it is likely to be sunny in nearby town. The concepts supporting this observation are array traversals, sequential execution of code.