GATE CS 2024 Set 1 — Question 56

NAT+2 / -0MediumCache NumericalsMemory Hierarchy & CacheComputer Organization & Architecture

Computer Organization & Architecture → Memory Hierarchy & Cache → Cache Numericals

Last updated

Question

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 _________

Correct answer

3 to 3

Solution

To calculate the speedup achieved with a perfect cache, we compare the execution time (or CPI) of the program with the actual cache to the execution time with a perfect cache.
1. Identify Given Parameters:
  • Ideal CPI (CPIidealCPI_{ideal}) = 2
  • Percentage of load/store instructions = 25% = 0.25
  • Instruction cache miss rate (mim_i) = 2% = 0.02
  • Data cache miss rate (mdm_d) = 8% = 0.08
  • Miss penalty (PP) = 100 cycles
2. Calculate Stalls per Instruction for the Actual Cache:
  • Instruction Fetch Stalls: Every instruction requires a fetch from the instruction cache.

StallsI=1×mi×P=1×0.02×100=2 cycles\text{Stalls}_{I} = 1 \times m_i \times P = 1 \times 0.02 \times 100 = 2 \text{ cycles}
  • Data Access Stalls: Only load/store instructions access the data cache.

StallsD=0.25×md×P=0.25×0.08×100=2 cycles\text{Stalls}_{D} = 0.25 \times m_d \times P = 0.25 \times 0.08 \times 100 = 2 \text{ cycles}
  • Total Stalls per Instruction:

Total Stalls=StallsI+StallsD=2+2=4 cycles\text{Total Stalls} = \text{Stalls}_{I} + \text{Stalls}_{D} = 2 + 2 = 4 \text{ cycles}3. Calculate Actual CPI (CPIactualCPI_{actual}):CPIactual=CPIideal+Total Stalls=2+4=6CPI_{actual} = CPI_{ideal} + \text{Total Stalls} = 2 + 4 = 64. Calculate Perfect Cache CPI (CPIperfectCPI_{perfect}):
A perfect cache has a 0% miss rate, meaning there are no memory stalls.CPIperfect=CPIideal=2CPI_{perfect} = CPI_{ideal} = 25. Calculate Speedup:Speedup=Execution TimeactualExecution Timeperfect=CPIactualCPIperfect\text{Speedup} = \frac{\text{Execution Time}_{actual}}{\text{Execution Time}_{perfect}} = \frac{CPI_{actual}}{CPI_{perfect}}Speedup=62=3.00\text{Speedup} = \frac{6}{2} = 3.00The speedup achieved with a perfect cache is 3.00.

More questions on Memory Hierarchy & Cache

Practice GATE CS PYQs with adaptive difficulty

Timed practice, skill tracking, and AI explanations — free to start.

Start practicing free