Memory Hierarchy Design Principles: Access Time, Cost, and Size Trade-offs
A computer’s memory hierarchy is designed to reconcile three opposing goals: (1) fast access time, (2) reasonable cost per bit, and (3) large capacity. This is done by arranging storage from small/fast to large/slower (e.g., registers → caches → DRAM → storage) and by using locality-based policies so that most accesses hit in faster levels. The hierarchy’s effectiveness is evaluated using effective access time models that combine hit time and miss penalty, which originate in cache behavior and lower-level latencies.2
The core design principles include:
- Exploiting locality with caches sized to cover the working set.
- Leveraging the trade-off curve between access latency and storage density across technologies (e.g., SRAM vs DRAM).
- Choosing structure parameters (block/line size, associativity, replacement policy) that balance miss rate vs hit time/cost.2
Footnotes
-
Computer Architecture: A Quantitative Approach (cache basics and locality). - Course notes summarizing locality, caches, and cache organization trade-offs. ↩
-
Hennessy & Patterson AMAT / cache performance model (hit time & miss penalty). - Lecture materials commonly deriving AMAT from hit/miss behavior. ↩
-
SRAM vs DRAM: latency and density trade-offs overview. - Describes SRAM behavior and contrasts with DRAM. ↩
-
DRAM overview: cost/density vs latency context. - Explains DRAM’s density and latency characteristics. ↩
Cache Fundamentals and the Memory Hierarchy (Locality + Hit/Miss/AMAT)
Key terminology and the AMAT framework
To reason about performance, architectures use the hit/miss model. If a cache has hit time and miss penalty , then the average memory access time (often called AMAT) can be expressed as:
where is the miss probability.2 This formula shows why memory hierarchy design is fundamentally a trade-off optimization:
- Making a cache faster reduces (often also reducing bandwidth/size or increasing area/power costs).
- Making a cache “bigger” may reduce (by capturing more of the working set), but typically increases hit time due to larger structures and wiring.2
- Miss penalty depends on the latency of lower levels (e.g., L2/DRAM) and the mechanism used to fetch/serve misses.2
Design implication: you typically cannot minimize by optimizing only one parameter; memory hierarchy levels must be co-designed.
Footnotes
-
Hennessy & Patterson AMAT / cache performance model (hit time & miss penalty). - Lecture materials commonly deriving AMAT from hit/miss behavior. ↩ ↩2
-
Cache performance and miss penalty discussions. - Covers hit/miss concepts and performance impacts. ↩ ↩2
-
Computer Architecture: A Quantitative Approach (cache basics and locality). - Course notes summarizing locality, caches, and cache organization trade-offs. ↩
-
Locality of reference and its role in caching. - Defines temporal/spatial locality and explains why caches work. ↩
From access-time, cost, and size to a concrete hierarchy decision
- 1Step 1
Determine which level dominates by profiling: compute miss rate per level and estimate miss penalties to lower levels.
- 2Step 2
Estimate whether the application’s working set fits within candidate cache capacities; locality principles suggest temporal/spatial reuse.2
Footnotes
-
Computer Architecture: A Quantitative Approach (cache basics and locality). - Course notes summarizing locality, caches, and cache organization trade-offs. ↩
-
DRAM overview: cost/density vs latency context. - Explains DRAM’s density and latency characteristics. ↩
-
- 3Step 3
Choose a cache line size that captures spatial locality: if a program accesses nearby addresses, larger blocks can reduce miss rate, but increase wasted bandwidth and can worsen hit time if structures grow.2
Footnotes
-
Computer Architecture: A Quantitative Approach (cache basics and locality). - Course notes summarizing locality, caches, and cache organization trade-offs. ↩
-
Locality of reference and its role in caching. - Defines temporal/spatial locality and explains why caches work. ↩
-
- 4Step 4
Set associativity to reduce conflict misses; pick replacement policies consistent with observed reuse patterns (e.g., LRU approximations vs cheaper heuristics).
- 5Step 5
Use device-level trade-offs (SRAM vs DRAM) to set realistic access-time targets for each hierarchy level; lower levels are slower but offer larger capacity per cost.2
Footnotes
-
SRAM vs DRAM: latency and density trade-offs overview. - Describes SRAM behavior and contrasts with DRAM. ↩
-
DRAM overview: cost/density vs latency context. - Explains DRAM’s density and latency characteristics. ↩
-
- 6Step 6
Compute AMAT-like estimates (including miss penalties) and check whether the chosen configuration meets area/power/cost budgets.
Why access time, cost, and size pull design in different directions
1) Access time: speed increases as you move toward the top
Caches are faster because they are built with faster memory and proximity to the CPU pipeline. However, increasing cache complexity (e.g., larger arrays, more associativity, longer tag checks, wider buses) increases critical path and often hit time.
A typical hierarchy statement is: hit time grows with cache size/complexity, while miss rate shrinks with cache capacity—so designers search for the best balance using AMAT.2
2) Cost: fast memory is expensive per bit
The hierarchy exists because fast storage is not the most dense (and therefore not the cheapest per bit). For example, SRAM is faster than DRAM but has lower density and higher cost per bit, which encourages using SRAM for small, fast caches and DRAM for large main memory.2
3) Size/capacity: larger structures reduce misses via working-set coverage
If a cache is too small, it cannot retain the active data/instructions set, increasing . If it is large enough, more accesses become hits, lowering average access time. This is the practical meaning of locality and the working set: a larger cache better covers the active region during periods of execution.3
Footnotes
-
Hennessy & Patterson AMAT / cache performance model (hit time & miss penalty). - Lecture materials commonly deriving AMAT from hit/miss behavior. ↩
-
Cache performance and miss penalty discussions. - Covers hit/miss concepts and performance impacts. ↩
-
SRAM vs DRAM: latency and density trade-offs overview. - Describes SRAM behavior and contrasts with DRAM. ↩
-
DRAM overview: cost/density vs latency context. - Explains DRAM’s density and latency characteristics. ↩ ↩2
-
Computer Architecture: A Quantitative Approach (cache basics and locality). - Course notes summarizing locality, caches, and cache organization trade-offs. ↩
-
Locality of reference and its role in caching. - Defines temporal/spatial locality and explains why caches work. ↩
Cache organizations: how block size, associativity, and replacement affect
Spatial locality and cache line/block size
If programs tend to access memory locations near each other (spatial locality), fetching a whole cache line reduces misses for subsequent accesses. But larger lines may:
- increase unused fetched data (wasted bandwidth/capacity),
- increase miss penalty (more data transferred),
- increase hit time (larger metadata/structures).2
Conflict misses and associativity
Even with enough total capacity, limited mapping (set index + tag) can cause different blocks to contend for the same set. Increasing associativity can reduce conflict misses by giving more candidate locations per set at the cost of more complex lookup and slightly higher .2
Replacement policy and effective locality capture
Replacement policy determines which blocks survive eviction when the working set doesn’t perfectly fit. Policies that better approximate true reuse patterns can reduce , but hardware cost (and potential lookup time) may increase.2
Mermaid view of the interaction
Footnotes
-
Computer Architecture: A Quantitative Approach (cache basics and locality). - Course notes summarizing locality, caches, and cache organization trade-offs. ↩ ↩2 ↩3
-
Locality of reference and its role in caching. - Defines temporal/spatial locality and explains why caches work. ↩ ↩2
-
Hennessy & Patterson AMAT / cache performance model (hit time & miss penalty). - Lecture materials commonly deriving AMAT from hit/miss behavior. ↩
type="tip" title="Pro Tip: Optimize AMAT, not just hit rate" content="When comparing designs, prefer over “hit rate only”. A design with a slightly higher hit time can still win if it sharply reduces or .2"
Footnotes
-
Hennessy & Patterson AMAT / cache performance model (hit time & miss penalty). - Lecture materials commonly deriving AMAT from hit/miss behavior. ↩
-
Cache performance and miss penalty discussions. - Covers hit/miss concepts and performance impacts. ↩
type="warning" title="Beware of “bigger is always better”" content="Increasing cache size reduces misses until the working set fits, but further growth can raise and cost/power. Beyond that point, AMAT can worsen because hit time increases faster than miss rate decreases.2"
Footnotes
-
Computer Architecture: A Quantitative Approach (cache basics and locality). - Course notes summarizing locality, caches, and cache organization trade-offs. ↩
-
Locality of reference and its role in caching. - Defines temporal/spatial locality and explains why caches work. ↩
Typical progression through memory hierarchy levels
Registers
1 (very fast)Smallest storage; fastest access; managed by the compiler/CPU pipeline."
L1/L2 caches
2 (fast caches)Exploit temporal/spatial locality; hit time is low; misses incur penalties."
DRAM main memory
3 (larger, slower)Large capacity at lower cost per bit than SRAM; higher latency drives miss penalties."
SSD/HDD
4 (very large, slow)Used via virtual memory and paging; serves as a last resort with very high latency."
Qualitative trade-off: latency vs capacity vs cost across hierarchy levels
Higher levels: lower latency but smaller capacity; lower levels: larger capacity but higher latency and typically lower cost per bit.
Design questions and edge cases
Knowledge Check
In the AMAT model , which design change most directly reduces the second term when miss probability dominates?