Now a computer has two different types of memory. One type is what is used in RAM modules, which is DRAM or a dynamic RAM. And DRAM is memory that uses capacitors to store data and these capacitors need to constantly and dynamically be refreshed often with electricity in order for them to store data. But there’s another sort of memory that a computer uses that does not need to be constantly refreshed. And this memory is called SRAM or a static RAM. And SRAM is what’s utilized in the CPU cache. and since SRAM doesn’t need to be constantly refreshed, it’s tons faster than DRAM and it is also very expensive.
The CPU cache is the CPU’s internal memory. And its job is to store copies of information and instructions from RAM that’s waiting to be used by the CPU. So basically, what the CPU cache does, is that it holds common data that it thinks the CPU goes to access over and once again because when the CPU must access certain data, it always checks the faster cache memory first to see if a knowledge it needs is there. And if it isn’t, then the CPU would need to return to the slower primary memory or RAM to get the info it needs. So that’s why cache memory is so important, because if the CPU can access what it needs on the faster cache, then the faster the pc will perform.
So basically, the entire idea behind CPU cache is to make the pc run faster at a less expensive price.
Now a computer can run without the CPU cache, but it might be tons slower because although RAM is becoming faster, it still can’t feed the information to the CPU fast enough because CPUs have gotten so fast, that tons of times the CPU is waiting around doing nothing while it waits for more data, and
this creates a bottleneck. So that’s why the CPU cache was developed. So, it can act sort of a middleman between the CPU and RAM to help in feeding the CPU that data it needs tons faster which reduces bottlenecks.
CPU cache comes in three different levels. for example, there’s level 1 cache, which is also called primary cache, and level 1 cache is found on the processor itself. So, it runs as the same speed as the processor. So, it’s extremely fast and is that the fastest cache on the computer. And there’s also level 2 cache, which is also called external cache, and level 2 cache is used to catch recent data accesses from the processor that weren’t caught by the level 1 cache. So, in a nutshell, if the CPU can’t find
that data it needs within the level 1 cache, it then searches the level 2 cache for the information. And if the CPU can’t find the information in the level 2 cache, then it searches the last level of cache which is level 3. And level 3 cache is employed to catch recent data accesses that weren’t caught by the level 2 cache. and eventually if level 3 doesn’t have the info, then the CPU has got to go back to the slower RAM to seek out the info it needs.
Now in earlier computers, level 2 cache was located on a separate chip on the motherboard. Or in modern CPUs, it might be located on the processor. Level 2 cache is larger than level 1 cache but it isn’t as fast as level 1 cache. And level 3 cache is additionally located on the processor. Level 3 is larger than level 2 but it isn’t as fast as level 2 cache. Level 3 is usually mentioned as shared cache because its memory is shared between all the cores on the CPU, whereas level 1 and level 2 cache are dedicated to their own CPU core.