Memory Operation and Performance
- Locality: Code Examples
- Why Use Middle Bits as Index?
- Static Random Access Memory(SRAM)
- Dynamic Random Access Memory(DRAM)
- Magnetic disks
- Magnetic tapes
- Optical disks
Computers use memory technologies of varying size and speed to achieve both acceptable speed and size at an affordable cost.
Access Time: SRAM < DRAM < Mag Disks
Cost: SRAM > DRAM > Mag Disks
This scheme of taking advantage of several memory technologies to get both speed and size is called a memory hierarchy.
Locality of Reference
The immediate future will be similar to the immediate past and that memory addresses that have been accessed recently are likely to be accessed again.
- Spatial and Temporal Locality
- References to a single address occurclose together in time (this is calledtemporal locality).
- References to addresses that are nearto each other occur together in time(this is called spatial locality).
It is a property of programs, not of computers.
Program’s locality is a property of the program’s behavior, and not of the computer.
- Code Examples
- Typical computer designs have at least four levels in the hierarchy.
Registers are closest to the CPU, are smallestin size, and are also the fastest memory in thesystem
Furthest from the CPU is the disk, where largeinactive parts of programs sleep for long periods of time
In between: caches & main memory
The policy decisions for these levels are made as the program executes.
The computer has special cache hardware that moves data from memory to cachesand vice versa。
[简答题] Design of Hierarchy: Strategies
- Cache Hits
- Cache Misses
- Cold Misses (Compulsory Misses)
- Conflict Misses
- Capacity Misses
C = B X E X S
Why Use Middle Bits as Index?
- Set Associative Cache
- Fully Associative Cache
VA -> MMU -> PA
- 缺页：交换 / 页面调度