Cache Memory

What is cache memory and its levels?

Hardware

Cache Memory:

A CPU cache is a cache memory used by the CPU of a computer to reduce the average time to access main memory. The Cache is a smaller & faster memory that stores copies of the data from the most frequently used central memory location. Cache Memory holds data and instructions that are transferred to and from the main memory. When a disk is read, a large block of data is moved into the cache. Thus, slow disk access is avoided again and again by using cash memory. There are three levels of cache memory in modern computer architectures, for example, L1, L2 and L3.

Cache Memory

Most of the new microprocessors have the Cache memory added in the CUP chip itself to speed up the process even further. even on these CPUs with built-in internal Cache, you an add external Cache.


Memory Levels

Level 1 (L1):

The L1 cache is divided into separate instruction and data caches, each serving a specific purpose. The instruction cache stores frequently used instructions, while the data cache stores frequently accessed data.

Also, the L1 Cache is built into the actual processor core, and it is typically 64 or 128 Kb in size, which operates at the same clock frequency as the rest of the CPU.

Level 2 (L2):

The L2 cache serves as a secondary cache, storing additional instructions and data that may not fit in the L1 cache. It helps reduce the time it takes to fetch data from the main memory. The L2 Cache is normally much larger (and unified), such as 256, 512, or 1024 KB. The Purpose of the L2 Cache is to constantly read slightly larger quantities of data from RAM so that these are available to the L1 cache.

CPU TypeL2 Cache
Pentium K5, K6External, on the motherboard
Pentium ProInternal, in the CPU
Pentium II, AthlonExternal, in a module close to CPU
Celeron (1st generation)None
celeron (later gen.), Pentium III, Athlon XP, Duron, Pentium 4Internal, in the CPU

Level 3 (L3):

The L3 cache helps improve overall system performance by providing a larger pool of cache memory that can be shared among multiple processor cores. This is especially important in multi-core and multi-processor systems. The L3 cache is larger but also slower than L1 and L2, its size is between 1MB to 8MB in Multicore processors, each core may have separate L1 and L2, but all cores share a common L3 Cache. L3 cache double speed than the RAM.

Note: Cache memory is a very high-speed memory built into the processor and it is used between the main memory (RAM) and the processor.

In summary, the purpose of the cache hierarchy is to provide a compromise between speed and storage capacity. The smaller, faster caches (L1 and L2) store the most critical and frequently accessed data, while the larger, slower caches (L3) provide additional storage for less frequently accessed data. The goal is to minimize the time it takes for the CPU to access the data it needs, improving overall system performance.

Learn more about Cache Memory Performance and Mapping.

Category: Hardware

on: 19 Oct 2020

on: 28 Jan 2021

What's Next?

We actively create content for our YouTube channel and consistently upload or share knowledge on the web platform.