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. Utilizing the hierarchy of memory storageUsing complex algorithms, the most relevant data can be siphoned from secondary memory stored ahead of time and stored in the cache and RAM. When searching for it needs data, the CPU can grab look for it from in the cache, . If it is there then it is a cache hit. If it is not there, it is a cache miss, then and it looks moves 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 ===