CPU memory cache
Modern CPUs are very fast at computing and when we want to achieve maximum performance, memory access is the main bottleneck. A good estimate for memory access is about 150 nanoseconds. In that time, our 3.6 GHz CPU has gone through 540 clock cycles. As a rough estimate, if the CPU executes an instruction every two cycles, that’s 270 instructions. For a normal application, memory access is an issue, even though the compiler may reorder the instructions it generates and the CPU may also reorder the instructions to optimize memory access and try to run as many instructions as possible.
Therefore, to improve the performance of modern CPUs, we have what’s called a CPU cache or memory cache, which is memory in the chip to store both data and instructions. This memory is much faster than RAM and allows the CPU to retrieve data much faster, significantly boosting overall performance.
As an example of a real-life cache, think about a cook. They need some...