- 2070 Chaitra · 5 marks
Associative vs set associative mapping
Short answer
Associative mapping allows a block in any line, uses full tag and parallel comparison of all tags, highest hit ratio but costly. Set associative divides cache into sets; a block maps to a fixed set (by index) but any line within the set, requiring only k comparators. It reduces cost and conflict misses compared to direct mapping, with near-associative hit ratio for k≥4.
Differentiate between associative mapping and set associative mapping with example.
| Point | Associative mapping | Set associative mapping |
|---|---|---|
| Placement | A block can go in any cache line | A block goes in one fixed set, any line of the set |
| Address format | Tag, word | Tag, set, word |
| Tag length | Longest | Shorter by the set bits |
| Comparators | One per line, all in parallel | k per set (k-way) |
| Hit ratio | Best | Slightly less, close for k = 4 or 8 |
| Cost and speed | Costly and slowest search | Cheaper and faster |
| Replacement | Over the whole cache | Within the selected set only |
| Conflict misses | None | Few |
Example
Main memory of 32 blocks (5-bit block number), cache with 8 lines, 2-way set associative; consider block 21 (10101).
- Associative: block 21 may go to any of the 8 lines; the 5-bit tag 10101 is compared with all 8 tags.
- Set associative (2-way): sets = 8/2 = 4. Set = 21 mod 4 = 1 (binary 01), tag = 21 div 4 = 5 (101). Block 21 can use either of the two lines of set 1; only 2 tags are compared. Blocks 1, 5, 9, 13, 17, 21, 25 and 29 all compete for the two lines of set 1.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Set associative mapping · Computer Organization and Architecture, chapter 6
- Write policy; direct vs associative mapping · Computer Organization and Architecture, chapter 6
- Associative mapping and replacement algorithms · Computer Organization and Architecture, chapter 6 · asked 2×
- Associative cache mapping with example · Computer Organization and Architecture, chapter 6
- Replacement algorithm in associative mapping · Computer Organization and Architecture, chapter 6
- Associative mapping technique · Computer Organization and Architecture, chapter 6
- Associative cache mapping · Embedded System, chapter 4 · asked 2×
- TST vs STS; DTMF set pros and cons · Telecommunications, chapter 4
- Compaction vs coalescing; paging mapping · Operating System, chapter 4
- Cache memory mapping techniques · Embedded System, chapter 4 · asked 3×
All Computer Organization and Architecture chapter 6 questions →