Memory Hierarchy
High Level
- Registers
- Cache
- Multiple levels (each larger and slower than the last)
- SRAM
- Managed by: Hardware
- Scale: KiB, MiB
- Main Memory
- DRAM
- Managed by: Operating System
- Scale: GiB
- I/O Devices
- Disk storage, flash storage
- Flash is a middle ground between hard disk and RAM
- Reads nearly as fast as RAM, but writes a lot slower (still better than HD though)
- Flash also has a limited number of writes
- Managed by: Operating System
- Scale: TiB
Detailed Levels
- Pipeline registers
- Register file
- 1st Level Cache (on chip)
- 2nd Level Cache (on same MCM as CPU)
- (more cache levels)
- Physical memory (mounted on same board as CPU)
- Virtual Memory (on hard disk, same enclosure as CPU)
- Disk files (on hard disk, same enclosure as CPU)
- Network-accessible disk files (same building as CPU)
- Backup/archive system (same building as CPU)
- Data warehouse (same planet as CPU)
- 1, 3-7 are usually made invisible to (even assembly) programmers
- 2 is invisible to high level languages
Physical
Memory
- Static Random Access Memory (SRAM)
- Used in the cache (the buffer within the processor)
- Faster and less dense than DRAM → More expensive
- Dynamic Random Access Memory (DRAM)
- Nonvolatile Memory
- Secondary memory
- Stores data between runs
- Either flash (faster, more expensive, and longer life) or magnetic disk (not that)
Stacking
- Vertical Stacking (3D)
- DRAM is stacked on top of the chip
- Has cooling issues
- Interposer Stacking (2.5D)
- DRAM is stacked next to the chip
- Both are on top of an interposer
- Interposer communicates between the two
Locality
- Temporal locality
- Items accessed recently are likely to be accessed again
- ex: instructions in a loop
- Spatial locality
- Items near those accessed recently are likely to be accessed soon
- ex: array data
- How Memory hierarchy uses this
- Store everything on disk
- Copy recently accessed (and nearby) items from disk to main memory
- Copy more recently accessed (and nearby) items from main memory to cache
- Cache hit means that accessed data is present in a faster level
- Hit ration = hits / accesses
- Miss ration = misses / accesses = 1 - hit ratio
Dependability
Virtual Machines