CITS2002 Systems Programming  
next CITS2002 CITS2002 schedule  

The Principle of Referential Locality

Numerous studies of the memory accesses of processes have observed that memory references cluster in certain parts of the program: over long periods, the centres of the clusters move, but over shorter periods, they are fairly static.

For most types of programs, it is clear that:

  • Except for infrequent branches and function/procedure invocation, program execution is sequential. The next instruction to be fetched usually follows the last one executed.
  • Programs generally operate at the same "depth" of function-invocation. References to instructions cluster within (and between) a small collection of functions.
  • Most iterative control flow (looping) is over short instruction sequences. Instructions from the same memory locations are fetched several times in succession.
  • Access to memory locations holding data is, too, constrained to a few frequently required data structures, or sequential steps through memory (e.g. when traversing arrays).

With reference to paging schemes, this locality of reference suggests that, within a process, the next memory reference will very likely be from the same page as the last memory reference.

This will impact heavily on our next enhancement to memory management: the use of virtual memory.

 


CITS2002 Systems Programming, Lecture 14, p1, 12th September 2023.