83
edits
Changes
m
→What is a Cache?
If the CPU solely relied on getting data from secondary memory, the slow access speed of the storage device would become a massive bottleneck in computation time. There would be huge gaps of time where the CPU sits around doing nothing waiting for data. To the end user, your machine would appear to be extremely sluggish and non-responsive.
At the same time, only small amounts piece of data is needed at a given moment. Even if you brought everything in from memory, most of it will be unused. Using complex algorithms, the most relevant data can be stored ahead of time in the cache and RAM. When it needs data, the CPU can look for it in the cache. If it is there then it is a cache hit. If it is not there, it is a cache miss and it must search main memory or even further down the hierarchy until it finds it. Minimizing the number of cache misses ensures the CPU has a steady flow of data it can quickly retrieve and compute.
=== Cache Coherence and Cache Line ===