Skip to main content

Which cache is better (2KB vs 8KB)

Short answer

Average access time = hit_rate × hit_cost + miss_rate × miss_cost. Cache A: 0.85×2 + 0.15×30 = 6.20 cycles. Cache B: 0.95×4 + 0.05×30 = 5.30 cycles. Cache B is better with lower average access time.

Determine which cache memory is better:

SizeMiss RateHit CostMiss Cost
Cache A2KB15%2 cycles30 cycles
Cache B8KB5%4 cycles30 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 (2KB): miss rate 15 %, hit rate 85 %

 = 0.85 x 2 + 0.15 x 30
 = 1.70 + 4.50
 = 6.20 cycles

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

 = 0.95 x 4 + 0.05 x 30
 = 3.80 + 1.50
 = 5.30 cycles

Answer: Cache B is better, with an average access time of 5.30 cycles against 6.20 cycles.

The larger cache B has a slower hit time, but its much lower miss rate more than compensates, so B 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.50, B = 5.50; the conclusion is the same.)

✓ Answer checked by Claude Opus 5.5 (high effort)

All Embedded System chapter 4 questions →