What is a Cache when you are talking about a prosessor.

Nickiel12

Reputable
Nov 27, 2015
67
0
4,640
I am looking to build a computer and I have come across the word Cache several times and cannot find a explanation that makes sense. Could someone help me please?
 
Typically, a CPU cache is a small amount of very fast low latency memory physically located on the CPU die in order to to facilitate faster data access. You're talking a good 100x the performance of main memory here.

Most CPUs now feature at least two levels of cache, most consumer models now feature three. Each level is larger, but takes longer to access. In addition, higher levels of cache may be shared between cores, mostly to save costs.
 


The L1, L2, and other levels of cache refer to different cache units. As a general rule, each level of cache is larger, but slower to access then the one before. The L1 cache is by far the fastest, but smallest of the three. As a comparison, reading/writing to the L2 cache is 10-20 times slower then it is accessing the L1.

The primary reasons for adding so many levels of cache on the CPU is really to just get around the fact memory access is slow. Even the slowest level cache for consumer CPUs, the L3 cache, is still about twice as fast as accessing main memory.

I don't know what the current typical access speeds are, but for the Pentium 4 architecture:

L1 cache: 1 clock cycle
L2 cache: ~20 clock cycles (20x slower then the L1)
Main Memory: ~80 clock cycles (4x slower then the L2, 80x slower then the L1)
HDD (Page Fault): ~100k clock cycles (you get the idea)

Which highlights why we use CPU cache; it's a lot faster then accessing main system memory. GPU VRAM operates pretty much the same way; it's local memory on the die that is a lot faster to access then main system memory.
 
Cache latency is also important. It's also "Hit and miss" system with FIFO (First In, First Out) that means that data in them is retained on basis that when filled (the goal is to have it filled all the time) first data in is replaced by newest. OS and programs have to be fully aware of it and have good prediction to use it properly. That's why it can have different impact on different OSes and/or programs.
 


You might want to read this: https://cseweb.ucsd.edu/classes/fa11/cse240A-a/Slides1/04_Jouppi.pdf

 

TRENDING THREADS