A given program has 25% load/store instructions. Suppose the ideal CPI (cycles per instruction) without any memory stalls is 2. The program exhibits 2% miss rate on instruction cache and 8% miss rate on data cache. The miss penalty is 100 cycles. The speedup (rounded off to two decimal places) achieved with a perfect cache (i.e., with NO data or instruction cache misses) is _______
GATE 2024 CS1 Q.56: solution and answer
Answer and solution
ANSWER
The speedup achieved with a perfect cache is .
Official answer: 3.00Source: Official answer key, GATE 2024 CS1 (IISc Bengaluru)
CPI_ideal (with a perfect cache, i.e. no memory stalls at all) is given directly in the stem: .
Instruction-cache stall cycles per instruction: every instruction must be fetched, so the instruction-cache miss rate applies to all instructions. cycles per instruction.
Data-cache stall cycles per instruction: only load/store instructions access the data cache, so the data-cache miss rate is scaled by the load/store fraction. cycles per instruction.
Real CPI (with the actual instruction and data caches, misses included) is the ideal CPI plus both stall contributions:
Since the clock cycle time and the instruction count are unchanged between the real machine and the perfect-cache machine, execution time is proportional to CPI. So the speedup from a perfect cache is
KEY IDEA
Memory stall cycles per instruction are added on top of the ideal (memory-stall-free) CPI to get the real CPI; speedup from a perfect cache is the ratio of real CPI to ideal CPI, since clock rate and instruction count are unchanged.
WATCH OUT FOR
Applying the data-cache miss rate to every instruction instead of scaling it by the 25% load/store fraction (or forgetting to add both instruction-cache and data-cache stalls), which gives a wrong real CPI and hence a wrong speedup.
From the GATE 2024 CS1 paper. Every question of this paper · Download the full paper · All 22 Memory & cache questions, with notes
More Memory & cache questions
- GATE 2023 CS Q.42 · MCQ · 2 marksA 4 kilobyte (KB) byte-addressable memory is realized using four 1 KB memory blocks.
- GATE 2023 CS Q.64 · NAT · 2 marksAn 8-way set associative cache of size 64 KB (1 KB = 1024 bytes) is used in a system with 32-bit address.
- GATE 2022 CS Q.24 · MSQ · 1 markLet WB and WT be two set associative cache organizations that use LRU algorithm for cache block replacement.
- GATE 2022 CS Q.33 · NAT · 1 markA cache memory that has a hit rate of 0.8 has an access latency 10 ns and miss penalty 100 ns.
