Principle of Locality of References


There are four primary technologies used in building memory hierarchy: (i) SRAM (static random access memory), (ii) DRAM (dynamic RAM), (iii) flash memory, and (iv) magnetic disk. The table shows the access time and price per bit among these memories using typical values for 2020:

Memory technology Typical access time $ per GiB in 2020
SRAM semiconductor memory 0.5–2.5 ns $500–$1,000
DRAM semiconductor memory 50–70 ns $3–$6
Flash semiconductor memory 5,000–50,000 ns $0.06–$0.12
Magnetic disk 5,000,000–20,000,000 ns $0.01–$0.02

The memory hierarchy is based on the principle of locality of references, which states that programs access a relatively small portion of their address space at any instant of time. There are two types of locality: The data is similarly hierarchical: a level closer to the processor is a subset of any level further away, and all the data is stored at the lowest level (which is not true since the introduction of flash memory).

If the data requested by the processor appears in the upper level, this is called a hit. Otherwise, the request is called a miss. The lower level in the hierarchy is then accessed to retrieve the block containing the requested data. The hit rate or hit ratio, the fraction of memory accesses found in the upper level, is usually high because of the principle of locality of references.




      Give me a beer.    
      I am having one for the road (a final drink before leaving).