Location: Home Page > Article Article
What is purpose of processor cache? Popular Science on Role of CPU Cache
Because CPU is main hardware, I believe that when choosing a CPU, we will pay attention to parameters of CPU. In CPU core parameters, we often see cache parameter (Cache), so what is use of CPU? cache? Let's share popular science data about role of processor cache memory.
What is a processor cache?
The CPU cache is temporary storage between CPU and memory. Although cache capacity cannot be compared to memory and hard drive, exchange speed is much faster than them. The CPU cache is designed to connect CPU and memory faster. Stored in staging environment. Simply put, since CPU speed is high and memory speed is low, CPU cache is used to solve this problem, reducing CPU latency and improving latent performance of CPU.
For example, if CPU needs to perform an addition operation, it takes -2 cycles. If it takes 100-300 cycles to read data from memory, CPU cannot wait that long, even if it is a high performance processor. The processor also becomes slower, so processor's latency is reduced by caching.
In main processor, total cache is divided into L1 cache, L2 cache, and L3 cache, and speed between them decreases while capacity increases. A read requires 3 cycles of information in L1 cache, which is infinitely close to speed of CPU processing operations. The read cycle of L2 cache is about 10-15 cycles, while time required for L3 cache is about 50 cycles.
The reason why CPU needs to adopt this hierarchical structure is mainly to balance cost, performance, capacity, and area. As for CPU cache, following points are their improvement, which is so-called CPU cache role.
1. Reduce latency
Cache access time should be as short as possible. This time can be reduced in various ways, such as reducing cache latency by reducing cache size or associativity, and by methods such as prediction and increased throughput. .
2. Increase number of hits
The so-called hit rate is rate at which memory is found in cache. We hope to get information from cache first to get speed advantage, so cache should maximize this goal. For a single cache, size, associativity, and block size determine hit rate.
3. Reduce load on lower memory levels
The cache is part of memory hierarchy and its performance affects other performance. The more time it takes to process other memory, slower performance of system. That is, let processing be done in cache as much as possible.
4. Reduce penalty for misses
Cache misses are inevitable, but we can reduce time it takes to process misses to improve CPU performance by increasing number of hits and applying various optimizations that can reduce penalty for misses.
The cache is a very important part of CPU that takes up a lot of resources and costs. If you have seen a CPU architecture diagram, you will find that cache takes up at least 50% of area, i.e. absolutely decisive.
The role of CPU cache is to increase hit rate, reduce latency, reduce memory overhead, reduce penalty for misses, etc. Normal users only need to understand that CPU cache can improve CPU efficiency. in cpu parameter, role is decisive.