GuidesWikiL2 Cache: How It Works & Importance

L2 Cache: How It Works & Importance

L2 cache is a temporary storage that reduces the latency between CPU-RAM operations. It is the storage that the CPU can access quickly.

Expert Verified By

When choosing a CPU, most people focus on core counts and clock speeds — which makes sense since they have a big impact on performance. However, the cache is also a component of your CPU. There are different cache levels. This article will explain how the L2 cache works and how it compares to its L1 and L3 counterparts. 

Key Takeaways

  • L2 cache is a form of temporary storage that reduces the latency between CPU-RAM operations.
  • It is larger but slower than the L1 cache and also further away from the microprocessor than the L1 cache. 
  • L2 cache size varies from 2.5 MB to 32 MB (or even more) in modern CPUs. 

What Is CPU Cache

Before I explain L2 cache, you need to know what CPU cache is in general. CPU Cache[1] is a form of temporary storage that fetches data (from system memory, or DRAM) and stores it in its own memory for faster access. This memory is termed Static RAM[2] or SRAM.

CPU cache is much faster than DRAM; however, it’s also much more expensive. There are three types or “levels” of cache: L1, L2, and L3. These levels are differentiated based on their distance from the CPU microprocessor, speed, and size.

What Is L2 Cache 

L2 cache (also called secondary cache) is the second level of CPU cache. This means that it is further away from the CPU than the L1 cache (although both are found in the CPU package in modern processors). The L2 cache is also larger in size and capacity than the L1 cache[3]

CPU block diagram
L2 (and L1) cache in a dual-core CPU and its data flow – (Image by embedded.com)

The SRAM used in the L2 cache is about 25 times faster than DRAM[4]. Regarding size, the L2 cache varies in modern CPUs, from about 2.5 MB (for entry-level CPUs) to 32 MB for high-end CPUs[5]

How Does L2 Cache Work?

As explained, the cache is a temporary storage from which the CPU can access data more quickly than it can from the DRAM, reducing latency. Thus, it acts as a bridge between the CPU and the RAM[6]. This obviously applies to the L2 cache (along with L1 and L3).

CPUs take important data from DRAM and store it in the cache (a process called prefetching). The data travels from the DRAM to the CPU cache through the system bus[7], as visualized above. The cache that receives it may be L2 (it could also be L1 or L3). Thus, the CPU now has faster storage to access data when needed.

When the CPU needs to access prefetched data, it searches for it in the L1 cache, as it’s the closest one. If it does not find the data there (cache miss[8]), it looks for the data in the L2 cache. Assuming the data is found in L2, it is used by the CPU to perform the necessary task — a cache hit[9]. If it does not find the data in L2, it repeats the same process for L3.

Why More Cache Is Better

More cache is always better as the CPU has access to more high-speed memory to store instructions temporarily. This is why CPU manufacturers attempt to fit as much of this tiny memory into their CPUs as possible.

A CPU with more L2 cache will perform better than that with less L2 cache, provided the rest of the specifications of the CPU don’t alter the outcome of the comparison. 

L2 Vs L3 Cache: What’s The Difference?

L3 Cache Block Diagram
L3 Cache Block Diagram (Image By Cornell University)

You’ve already learned that the three CPU cache levels differ in size, speed, and distance from the CPU. The L2 cache is closer to the microprocessor than the L3 cache[10]. It is also faster than the L3 cache and, at the same time, is found in less capacity in CPUs compared to the L3 cache.

Furthermore, each core has a specific amount of L2 cache. There may be two pools of L3 cache in CPUs with higher core counts, such as the Ryzen 9 5950X, which has 16 cores; each set of 8 cores shares 32MB of L3 cache. 

Final Thoughts

L2 cache is an essential component of CPUs and reduces the latency between the CPU and DRAM. However, the L2 cache count isn’t the sole specification you should look at in a CPU when deciding on the right option.

CPU core counts and clock speeds should be your primDontary focus. If you choose a CPU with the ideal core counts and clock speeds, it’s likely the CPU already has the right amount of L2 cache to go with it.

Related Helpful Resources By Tech4Gamers:

References:

  1. Basics of Cache Memory
  2. SRAM TECHNOLOGY
  3. Caches & Memory
  4. Difference Between SRAM and DRAM
  5. Cache Memory
  6. Cache Performance
  7. Overview of Computer Busses
  8. Cache Miss
  9. Cache Hit
  10. Memory

Frequently Asked Questions

What is the function of L2 cache?

L2 cache reduces the latency between the CPU and the memory by providing much faster temporary storage for the CPU to access data quickly.

Is L2 cache important for gaming?

L2 cache is a vital component of CPUs as it provides high-speed memory for the CPU to store instructions in. Thus, a good amount of L2 cache is crucial for gaming.

How does L2 cache differ from L3 cache?

L2 cache is faster but less capacious than L3 cache. Also, the L3 cache is typically in the form of a “pool” shared by multiple cores, while each core has its own L2 cache.

Was our article helpful? 👨‍💻

Thank you! Please share your positive feedback. 🔋

How could we improve this post? Please Help us. 😔

Join Our Community

Still having issues? Join the Tech4Gamers Forum for expert help and community support!

Related articles

Is It Safe To Buy Intel CPUs Now?

Has Intel managed to recover from its disastrous PR nightmare revolving around 13th/14th Generation CPU instability in 2024?

Is AMD Losing Its Edge? A Look At Recent Trends

AMD is losing its edge due to CPU and GPU performance issues, raising concerns about its market position and innovation.

Nobody Wants To Die Feels Like Watching A Netflix Crime Show

Nobody Wants To Die faetures an unconventional concept with the blend of the past and the future and is so relaxing to play.

3DMark Suite: A Complete Guide To All Features

3DMark Suite offers a variety of tests, each focusing on a different API, rendering technique, and devices, unlike its competition.

AMD EXPO [Features & How You Can Enable It]

AMD EXPO is for their AM5 platform and is an answer to Intel X.M.P which is exclusively available for Intel processors.

Similar Guides