Computer Memory

Memory Hierarchy

A memory hierarchy consists of multiple levels of memory with different speeds and sizes.

Faster memory (which are more expensive) are put close to the Processor.

Memory Hierarchy takes advantage of the Principle of Locality:

  • We take advantage of temporal locality by keeping more recently accessed data items closer to the processor
  • We take advantage of spatial locality by moving blocks consisting of multiple contiguous words in memory to upper levels of the hierarchy

Data is stored hierarchically in memory:

  • All the data is stored at the lowest level of memory, and as we move up, we have a subset of the entire data
    • Just like how the books you are taking is a subset of the entire books of the library. And your library is a subset of all the libraries on campus.

Levels

A memory hierarchy can consist of multiple levels, but data are copied between only two adjacent levels at a time, so we can focus our attention on just two levels: upper level and lower level.

Screen Shot 2022-11-29 at 1.34.39 PM.png

The upper level is the one closer to the Processor, it’s the smaller and faster than the lower level.

We define key terms like Hit Rate, Miss Rate, Hit Time, and Miss Penalty to understand performance of Memory.

Then, we dive into the discussion of Cache for faster reads and writes.

Next up is Dependable Memory Hierarchy