Cache

Cache is a small, high-speed memory located inside or very close to the CPU that stores frequently used data and instructions.

It helps the processor access information faster than from RAM.

Why cache exists

The CPU is extremely fast. RAM is slower than the CPU. If the CPU had to wait for RAM every time, performance would drop.

Cache solves this problem by storing commonly used data closer to the processor.

How it works

  1. The CPU requests data.
  2. It first checks the cache.
  3. If data is found — this is called a cache hit.
  4. If not found — this is called a cache miss, and the CPU retrieves data from RAM.

Cache reduces the need to access slower memory.

Levels of Cache

Modern CPUs use multiple cache levels:

L1 Cache

  • Smallest
  • Fastest
  • Located inside each CPU core

L2 Cache

  • Larger than L1
  • Slightly slower
  • Usually dedicated per core

L3 Cache

  • Larger
  • Shared between cores
  • Slower than L1 and L2 but faster than RAM

Some high-end processors may also include L4 cache.

Cache Size

Cache is measured in:

  • Kilobytes (KB)
  • Megabytes (MB)

More cache can improve performance, especially in repetitive tasks.

Cache vs RAM

  • Cache = smaller, much faster, inside/near CPU
  • RAM = larger, slower, main system memory

Cache acts as a buffer between CPU and RAM.

Why it is important

  • Reduces memory access time
  • Improves CPU efficiency
  • Speeds up repetitive operations
  • Enhances overall system performance

Without cache, the CPU would constantly wait for data from RAM.

A simple example

Think of cache as a notepad next to your desk. Instead of walking to a cabinet (RAM) every time, you keep frequently used information on the notepad.

Related terms

Source

Information simplified from the Wikipedia article “CPU cache”.

Nach oben scrollen