r/computerscience • • 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?

261 Upvotes

97 comments sorted by

View all comments

226

u/Kike328 Dec 30 '23

yes, bullets are stored in ram, almost everything is stored in the ram, the 3d models, the weapons, everything, and when you close the program, those things are deleted from the ram.

141

u/[deleted] Dec 30 '23

I mean if he wants more than that, i guess we can go over the hardware perspective:

You damm computer is a glorified calculator, all the stuff you see on screen are LEDs light that will flash a different color depending on the results of those calculations, as you can see, there is many leds in that picture, thats are a fuckton of numbers, numbers that will not be useful on the next microsecond, so thats where ram (and cache) comes in handy, you store the numbers aka 'data' in a storage that will be flushed and cleaned as things are not useful anymore, thats why is called volatile memory, it wont(should not.) persist after the task is done.

A ram physically will be composed of: -storage cells (the square chonky integrated circuits) -memory controllers (other Ics that will write and read the storage cells) -an Input\ouput chip (this guy will manage the traffic of the information in and out of the ram) -and a discretional amount of pmics ( power management integrated circuits)

Those are the 4 kind of IC you will see physically, there will be spinoffs of this configuration depending of the product. But thats it my friend. What else do you need?

18

u/[deleted] Dec 30 '23

What an awesome explanation to a question I’ve never even thought about. Thanks dude!

6

u/havoklink Dec 31 '23

So it’s like a scratchpad/white board? Like the calculators calculator for quick work?

12

u/2skip Dec 31 '23

It's like the brain's short-term memory, and the reason it exists is to speed up retrieving data; there are multiple levels of memory in a computer: https://www.techtarget.com/whatis/definition/hierarchy#:~:text=Level%201%3A%20Cache%20memory,optical%20disks%20or%20magnetic%20tapes

In this case, RAM is at level 2, stuff in the device's processor is memory levels 0 and 1, apps (like games on a phone) are stored at level 3, and SD cards (for photos/videos) are at level 4.

3

u/[deleted] Dec 31 '23

Yes the hierarchy is a great example (if you know nothing nothing about hardware architecture, start from this concept, what an ALU is, and arquitecture philosofies like hardvard and vonn neumann

Thats where i add my sauce: all of this are concepts for the engineer to have a grasp about hardware arquitecture, in practice the mofo hardware architect can andwill heavily modify these stablished concepts, i did work in a modem design that had an extra cpu register to store a value that will be used on the real data to encrypt it, so on practice my dude if you are gonna write low level stuff, or god forbid, validate the hardware itself, you get to become buddy buddy with the hardware architect

1

u/mindtap45 Jan 22 '25

Great explanation

6

u/SpacemanLurker Dec 31 '23

An easier way for me to remember is RAM is volatile memory. It deletes after a program is closed or loss of power.

4

u/ScientificBeastMode Dec 31 '23

Yeah, it’s like a person spinning plates in a circus, and the hard drive is like a giant shelf full of dishes.

1

u/Adventurous-Fudge470 Sep 02 '24

So basically the ram holds the entire game (the part needed at he time I guess. Multiplayer, campaign etc) as instructions and sends it to the processor to … process it?