Computer Memory

Memory is where information get stored and accessed in a Computer.


Memory is like Accessing books at a Library

The way you should think able memory is through the example of a library. Think of the accessing the memory like accessing books off the shelves, and bringing them back to your desk (the Processor).

There are two main distinctions for memory

  1. Main Memory
  2. Secondary Memory

The other categorization

You can also categorize between Volatile Memory and Non-Volatile Memory memory. Generally, main memory is volatile and secondary is non-volatile.

Four primary technologies used in today’s Memory Hierarchy:

This diagram from CS241E also helps visualize:

  • Update Hemal Shah drawing is a better mental model for me


Fundamental Idea: Locality

We uses the Principle of Locality in order to have super fast access to memory:

  • The idea is that programs usually access only a relatively small part of their address space at any instant of time.
    • Just like if you do research, you don’t need to access the whole library at the same time

There are two kinds of locality

  1. Temporal Locality
  2. Spatial Locality

We design a Memory Hierarchy to take advantage of the Principle of Locality.