r/computerscience • u/TranslatorParty4662 • Dec 30 '23
WTF does ram actually do?
I know that RAM stores data for quick use for the CPU. But I want to know more, what does RAM actually do when its storing data. Like when I'm playing a game is RAM responsible for keeping track of how many bullets I shoot. If there are any game developers reading this please let me know. What kind of information does RAM store and how and when does it use it. The main thing I use my pc for is gaming and recording/video editing so how would RAM play a role in those things?
260
Upvotes
View all comments
1
u/slxshxr Dec 30 '23
I might say something wrong here, i'm not entirely sure about some details as i had system architecture on university some years ago.
Processor uses something called cache to save data. You can google what cache is more precisely.
Now there are limitations to how fast you can access data. There are some levels:
Now - CPU register, L1, L2, L3 Cache are places where CPU can instantly look for data. It's very small so only frequently needed data is stored there.
RAM - Random Access Memory. Word random is crucial there, because there are things called "misses" - cold, capacity and conflict misses if i remember correctly.
Disks and webservers are way way way slower. To put into perspective - RAM is ~30x faster than Disks and L1 Cache is 10-100x faster than RAM :).
Basically RAM is a bigger cache memory that allows you to store data that are not needed almost all the time but you don't want to save it on disk. (for example how many bullets you shot), where faster caches are mostly used by operating system things.
If you want a better explanation than mine (not hard to do lol) it's better if u read about L1, L2 and L3 cache - then you will understand RAM