Computer Memory
Memory is where information get stored and accessed in a Computer.
Concepts
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
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:
- Main Memory uses DRAM (slower)
- Levels close to processor (Cache) uses SRAM (more expensive)
- Flash Memory used for Secondary Memory in personal mobile devices
- Disk Memory
This diagram from CS241E also helps visualize:
- Update Hemal Shah drawing is a better mental model for me
Resources
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
We design a Memory Hierarchy to take advantage of the Principle of Locality.