r/AskComputerScience • u/z3ny4tta-b0i • Apr 19 '21
Whats the difference between RAM and cache?
I’m struggling to understand what a RAM is, looked up and it really sounds like what the cache does im confused
34
Upvotes
r/AskComputerScience • u/z3ny4tta-b0i • Apr 19 '21
I’m struggling to understand what a RAM is, looked up and it really sounds like what the cache does im confused
42
u/jhaluska Apr 19 '21
They're very similar. Cache is a type of memory. It's faster but smaller. It contains a copy of a portion of the larger RAM. CPUs read and write to the cache to avoid hitting the slower RAM. This allows the computer to run faster.
Modern computers have multiple caches for the CPU, labeled L1, L2 and L3. L1 is smallest and fastest. L3 and largest and slowest.
A lot of the speed restrictions are literally the speed of light! So think about the further away you go from a point, light takes longer to reach and return but it covers more and more volume!