Skip to main content

Which cache is better (4KB vs 12KB)

Short answer

Average access time = hit_rate × hit_cost + miss_rate × miss_cost. Cache A: 0.85×3 + 0.15×25 = 6.30 cycles. Cache B: 0.95×6 + 0.05×25 = 6.95 cycles. Cache A is better with lower average access time.

Determine which cache memory is better:

SizeMiss RateHit CostMiss Cost
Cache A4KB15%3 cycles25 cycles
Cache B12KB5%6 cycles25 cycles

The better cache is the one with the smaller average memory access time.

Formula: average access cost = (hit rate x hit cost) + (miss rate x miss cost)

Cache A (4KB): miss rate 15 %, hit rate 85 %

 = 0.85 x 3 + 0.15 x 25
 = 2.55 + 3.75
 = 6.30 cycles

Cache B (12KB): miss rate 5 %, hit rate 95 %

 = 0.95 x 6 + 0.05 x 25
 = 5.70 + 1.25
 = 6.95 cycles

Answer: Cache A is better, with an average access time of 6.30 cycles against 6.95 cycles.

The larger cache B has a slower hit time, but its much lower miss rate does not compensate for it here; the smaller cache A wins. (If miss cost is taken as an extra penalty on top of the hit time, the cost is hit cost + miss rate x miss cost: A = 6.75, B = 7.25; the conclusion is the same.)

✓ Answer checked by Claude Opus 5.5 (high effort)

All Embedded System chapter 4 questions →