Caching and Locality Flashcards
What is RAM?
- RAM (Random Access Memory): Type of computer memory used to store data that the CPU can quickly access. This is memory the computer is actively using (different from long-term storage like SSDs)
- Modern RAM is known as DDR (double data rate), which improves speed and efficiency
It is much faster for a CPU to get data from ____ than from a hard drive or SSD.
RAM
No matter how fast the clock speed is over a CPU, the RAM speed ________ changes
never
What is cache memory?
- Faster memory in RAM stored either just outside the CPU or within the CPU cores itself
- Typically 3 levels of Cache, L1, L2, L3
- The lower the number, the faster the cache is
Describe the 3 levels of cache:
*L3: Exists across multiple CPU cores. Slightly bigger than other caches but not as big as ram. Usually located on the CPU chip.
* L2: Slightly faster and smaller than L3 cache, located close to CPU cores.
* L1: Smallest but fastest cache and typically is integrated directly into CPU cores. L1 caches are extremely close to CPU cores and provide low-level latency access to frequently used data and instructions
When is it usefulf or data to be stored in the cache?
- The most frequently used data is stored in cache memory
- CPU doesn’t have to visit the RAM to get the data it needs
- CPU gets access to cache memory extremely quickly
How long do the different caches and RAM take to access, approximately:
- L1 and L2: 1 Nanosecond
- L3: 10 Nanoseconds
- Main Memory (RAM): Up to 100 Nanoseconds
Note: There are 1 million nanoseconds in a millisecond, and 1000 milliseconds in a second
What is a register and how many are there on a computer?
- 16 general purpose registers
- Register is a small amount of high-speed memory contained within the CPU
- CPU can only operate on values in registers but can request to load from RAM ->Register or store from Register->RAM
- The contents of every register loaded from RAM are L1, L2, and L3 cache
- Registers are always mutable