Open main menu

CDOT Wiki β

Changes

GPU621/False Sharing

5 bytes removed, 12:17, 26 November 2021
What is a Cache?
So why do we have so many types?
In an ideal world, the CPU would have lightning-fast access to all the data on your machine at any given time to maximize the power and speed and power of modern-day CPUs. In reality, there are limitations and trade-offs when balancing speed, storage size, location, and cost. To compromise, a computer utilizes many types of memory. To name the major important ones in the hierarchy, we have secondary memory like hard drives and SSDs which can permanently hold vast quantities of data but are slow. Next is Dynamic Random Access Memory(DRAM) which is much smaller, faster, and volatile. Last, we have the cache or Static Random Access Memory(SRAM), which is extremely fast, but even smaller and more expensive. 
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 any a given moment. Even if you brought everything in from memory, most of it will be unused. Using Utilizing the different types hierarchy of memory storage, the most relevant data can be siphoned from secondary memory ahead of time and stored in the cache and RAM. When searching for that data, the CPU can grab it from the cache (, a cache hit). If it is not there (, a cache miss), then it looks in RAM and then secondary memorymoves down the hierarchy until it finds it. By minimizing Minimizing the number of cache misses, this ensures the CPU has a steady flow of data it can quickly retrieve and compute.
=== Cache Coherence and Cache Line ===
83
edits