Cache Mapping, Virtual Memory and I/O Techniques in Computer Architecture
Q1. Cache Mapping Techniques
Cache memory is a small, fast memory placed between the CPU and main memory to speed up memory access. Mapping techniques determine how blocks from main memory are mapped to cache lines.
Three Types of Cache Mapping
1. Direct Mapping
In direct mapping, each block of main memory maps to exactly one specific cache line. The cache line number is determined by the formula:
Cache Line Number = (Block Address) mod (Number of Cache Lines)
Address format: The memory address is divided into three fields:
- Tag: Identifies which block is currently stored.
- Index: Identifies the cache line number.
- Block offset: Identifies the word within the block.
Advantages:
- Simple and easy to implement
- Fast access time
- Low-cost hardware
Disadvantages:
- High
English with a size of 27.48 KB