Types of Cache Misses: Conflict
What You'll Learn
You'll understand what conflict misses are and why they occur even when your cache isn't full.
The Core Idea
A conflict miss happens when multiple memory blocks compete for the same cache location, forcing evictions even though the cache has empty space elsewhere. This is the "wrong place at the wrong time" problem in caching.
How Conflict Misses Occur
In direct-mapped and set-associative caches, memory addresses map to specific cache locations using the cache address breakdown you've learned. When two frequently accessed blocks hash to the same cache set, they keep kicking each other out—even if other cache sets sit empty.
A Parking Analogy
Imagine a parking garage where your assigned spot depends on your license plate number. If you and your neighbor both have plates ending in "7," you're assigned the same spot. You'll keep stealing each other's space all day, even though spots for plates ending in "8" or "9" stay empty. That's a conflict miss.
In Set-Associative Caches
In a 2-way set-associative cache with 4 sets, suppose you repeatedly access blocks that all map to set #2. Once set #2 is full (holding 2 blocks), any new block mapping there causes a conflict miss—evicting a block that might be needed soon. Meanwhile, sets #0, #1, and #3 may be underutilized.
The Fix
This is why higher associativity helps: a 4-way set-associative cache gives each set more "slots," reducing conflicts. Fully associative caches eliminate conflict misses entirely (any block can go anywhere), but they're expensive to implement, as you learned with CAM hardware.
Key Takeaway: Conflict misses occur when multiple memory blocks map to the same cache set, causing evictions despite available space elsewhere—a problem that higher associativity helps reduce.