CPUs and architecture

What is the main purpose of cache memory?

  1. ATo retain data when the power is turned off
  2. BTo keep frequently used data close to the CPU and bridge the speed gap with main memory
  3. CTo correct errors in computation results
Show answer and explanation

Answer: B. To keep frequently used data close to the CPU and bridge the speed gap with main memory

While one clock cycle of a CPU running at several GHz lasts 0.2–0.3 ns, a DRAM access takes tens to 100 ns—hundreds of cycles. Frequently used data and instructions are therefore kept in fast SRAM caches to cut waiting. Caches exploit temporal locality (reusing the same data soon) and spatial locality (using nearby addresses next), with L1 reachable in a few cycles and even L3 in tens of cycles.