RAM Memory

Share

What is RAM memory?

RAM memory, or just RAM (Random Access Memory), are physical chips that are installed in your computer's motherboard where data needs to be stored before it can be processed by the CPU.

Modern PCs generally have at least 4 gigabytes of RAM. Some operating systems require a minimum of 8 gigabytes. It's not rare to see PCs with 16 or 32 GB of RAM.

RAM is typically installed as pairs of chips. This means if you have 8 gigabytes of RAM, that probably means you have 2 chips of 4 gigabytes each, instead of just 1 chip of 8 gigabytes. Naturally, this also means there are multiple RAM slots in the motherboard where you can insert the chips. If a motherboard only has 2 slots, that means you can't place more than 2 chips in it. Some motherboards also have a limit to how much RAM you can have in total.

Different CPUs are compatible with different types of RAM. Each RAM chip has a speed, a frequency, with which it can transfer data, measured in Hertz, and some frequencies work better with some CPUs.

Not all memory in a computer is RAM memory. Computers also have caches and registers that are built into the CPU, and permanent memory in the hard disks and SSDs.

In order to open a program, the program must first be sent from the hard disk or SSD and loaded into the RAM for the CPU to execute it. In order to open a file, the file must similarly be loaded into the RAM. Consequently, every program or file that the computer is interacting with in an instant must be loaded into the RAM. This means the more RAM you have, the more things you can do before you run out of memory.

Normally, when a program needs more memory, it sends a request to the operating system to reserve an amount of memory for it to use. If there is no memory left, that means the program can't do what it was going to do. For most programs, this is an unhandled exception: a fatal error that will crash the program. It has no way to cope with being denied a memory reservation.

If the program crashes because of this, it won't be able to save your files, which could be a big problem depending on what you're working on. Consequently, desktop operating systems use a technique called virtual memory to avoid an out of memory exception when possible.

When the memory is full and a program requests more memory space, the operating system arbitrarily frees some of the memory in the RAM to give it to the program requesting memory. The way it "frees" memory is very simple. It simply finds data in memory that isn't being used and saves it as a file in the hard disk or SSD. This is called a page file. The operating system has no way of knowing what that data is actually for. The only one who knows its purpose is the program that put that data in there. When that program needs the data, the operating system will need to take the data from the page file in disk and load it back in memory. But if the memory is still full, that means it will need to take something else in memory and put it in the page file. It will have to keep swapping one thing for the other until you close some applications to actually free some memory.

In this system, the total amount of memory the operating system and all programs can use is higher than the total amount of RAM, because you can just transfer parts of the RAM to the disk and vice-versa to expand it. You may be wondering why do you even need RAM, then, if you can just put the data in the disk.

That's because accessing and writing data to RAM memory is much faster than accessing and writing data in the hard disk. Whenever you need to use a page file, your computer slows down, sometimes severely to the point of becoming barely usable. But "barely usable" is still better than programs crashing without you having the opportunity to save your files, so this is acceptable.

Note that this solution only works reliably when multiple programs are using lots of memory. If you have a single program that needs a lot of memory at once, then it will need to be all in the RAM.

Comments

Leave a Reply

Leave your thoughts! Required fields are marked *