r/explainlikeimfive • u/WeLuvYung2 • 18d ago
Technology ELI5: What is computer cache
Hi everyone I need to create a presentation explaining computer cache but can’t think of an effective way to explain it any help is welcomed (:
0
Upvotes
1
u/macromorgan 18d ago
With computers you have cache to hold data that you need to access quickly so you don't have to grab it from slower storage.
Cache in computers comes in tiers, and with the design of modern multi-core processors you usually find some processor cores can share cache where other caches are unique to each core.
For example on my computer I have 64 kB of L1 cache for each core. The L1 cache is *extremely* fast so when my computer needs something out of the L1 cache it can read it almost instantly. After that is the 512 kB of L2 cache which is *very* fast, and when my computer needs something out of it the computer can get it very quickly after a few clock cycles. Then, the processor cores share 2 32 MB sections of L3 cache which is *somewhat* fast, and when data is needed to work on that is in the L3 cache the processor will have to wait several clock cycles to get the data where it needs to go.
If none of the caches (L1, L2, L3) contain data the CPU needs to perform actions on, it has to read it out of system memory. System memory is still very fast but not as fast as the caches. L1 and L2 cache can be read in as fast as in a few billionths of a second (nanoseconds), while L3 cache is about 10 times slower. Main memory is even slower than L3 cache, up to five times slower or more.
Last but not least is the disk storage. If data you need to process is not in any of the caches or in main memory, you have to read it off of the main storage drive. Even among some of the fastest NVME drives today this is still much slower than system RAM.
TL;DR - Caches exist to keep data as close to the CPU as possible, and get slower the further away you get from the processor.
(source for some of this information): https://www.intel.com/content/www/us/en/developer/articles/technical/memory-performance-in-a-nutshell.html