← All articles
technologywhat is RAMrandom access memoryRAM vs storageAugust 14, 20269 min read

What Is RAM? How Computer Memory Helps Apps Run

By the BrainSnail editorial team. How these articles are written and checked, and how to tell us when one is wrong.

RAM, or random access memory, is fast working memory that a computer uses to hold data and instructions it needs right now. It helps apps respond quickly, but its contents normally disappear when the device loses power.

What RAM does while you work

When you open a program, some of its code and data are copied from long-term storage into RAM. The processor can access information in RAM much more quickly than it can usually fetch the same information from a slower storage device. As you switch between a browser, a document, a game, and other apps, RAM holds many of the active pieces those programs need.

This is the practical answer to what RAM is. It is not a permanent library for all your files. It is more like a fast work surface where the system keeps materials that are currently in use. A larger work surface can hold more active material at once, while a smaller one may require the computer to keep moving things on and off the surface.

Operating systems manage RAM continuously. They assign memory to programs, protect one process from casually overwriting another, and free space when applications close. Modern systems can also keep recently used data in memory because unused RAM provides little benefit if it could instead make common tasks faster.

RAM vs storage is the key distinction

Storage keeps files for the long term. Solid-state drives, hard drives, and phone storage can retain photos, apps, documents, and system files after power is turned off. RAM is volatile working memory, so ordinary RAM does not keep its contents when the machine shuts down. This difference is central when someone asks what is RAM compared with storage.

Capacity is measured in bytes for both, which can make them easy to confuse. A laptop might have many gigabytes of RAM and hundreds of gigabytes or several terabytes of storage. The numbers describe different jobs. More storage lets you keep more files. More RAM can let more active data stay available without being moved to slower storage.

When RAM becomes crowded, an operating system may use part of the storage device as virtual memory or swap space. That helps prevent immediate failure, but storage is generally slower than physical RAM. If a system constantly moves data back and forth, you may notice pauses or sluggish switching between apps.

Does more RAM always make a computer faster?

More RAM helps most when memory capacity is the bottleneck. If your normal workload already fits comfortably in available memory, adding more may have little effect. A slow processor, graphics chip, storage device, network connection, or poorly written program can limit performance for completely different reasons.

Speed and type matter too. Computers support particular memory generations, speeds, and physical formats. The motherboard and processor decide what is compatible. This is why answering what RAM is for an upgrade requires more than choosing the largest number you can find.

A useful troubleshooting clue is to watch memory use during the tasks that feel slow. If RAM stays near full and the system is heavily using swap space, capacity may be part of the problem. If plenty of memory remains free, look for another bottleneck.

Why it is called random access, and why it forgets

The name random access sounds odd until you compare it with older storage. Magnetic tape is sequential: to reach data near the end of a reel, the machine must wind past everything before it. Random access means the computer can jump straight to any memory location using its address, and reaching one location takes about as long as reaching any other. Random here does not mean haphazard. It means any location can be chosen in any order, which is exactly what a processor needs when a program jumps between pieces of data.

Most main memory is dynamic RAM, which stores each bit as a tiny electric charge held in a microscopic capacitor. Those charges leak away within a fraction of a second, so the memory chips must constantly read and rewrite every row, a process called refreshing, many times each second. Cut the power and the refreshing stops, which is why the contents disappear. The faster cache memory inside a processor usually uses static RAM, built from small circuits of transistors that hold their state while powered without refreshing, but take up more space and cost more per bit.

Why a file takes more room in RAM than on disk

The size of a file on your drive can be a poor guide to how much memory it needs once opened. A photo from a 12-megapixel camera has about 12 million pixels, and each needs at least three bytes in memory, one each for its red, green and blue values. That makes about 36 million bytes, or roughly 36 megabytes, even though the compressed JPEG file on disk might be only a few megabytes. To display or edit the photo, the software has to decompress it into that full form. Editing apps then add layers and undo history, each potentially another full copy.

The screen itself has a similar appetite. A 4K display has 3,840 by 2,160 pixels, about 8.3 million in total, and with four bytes per pixel a single frame takes about 33 megabytes. Graphics systems usually keep more than one frame in memory so that a new image can be prepared while the current one is shown, and on many laptops with integrated graphics that memory comes from the same RAM your apps use. Web browsers behave in a comparable way, holding decoded images, page layouts and running scripts for every open tab, which is why dozens of tabs can fill memory quickly.

Bit flips, error correction and memory that lingers

The tiny charges in memory chips can occasionally be disturbed. A stray particle, such as a neutron produced when cosmic rays strike the atmosphere, can flip a stored bit from 0 to 1 or back again. On a single home computer this is rare, but across a data centre with thousands of servers it happens regularly. Servers and workstations therefore often use error-correcting code memory, or ECC, which stores extra check bits alongside each block of data. When the data are read back, the hardware can detect and correct a single flipped bit automatically, and detect some larger errors.

Another surprise is that ordinary RAM does not empty the instant the power is cut. Although the chips are refreshed many times a second to be safe, researchers showed in 2008 that they can keep much of their contents for seconds after losing power, and for minutes if the chips are chilled, for example with a can of compressed air sprayed upside down. An attacker with physical access could restart a machine, copy what remained in memory and search it for encryption keys. This is called a cold boot attack. Defences include wiping memory during shutdown and processors that encrypt the contents of RAM automatically.

The takeaway

RAM is fast, temporary working memory used for active programs and data. RAM helps the processor reach current information quickly, while storage keeps files after power is off. More RAM can improve multitasking when memory is tight, but it cannot fix every kind of computer slowdown.

Practise this

Questions from Computer Hardware

Reading about something is not the same as being able to recall it. These are real questions from the Computer Hardware unit in our Technology track, answers and explanations included. The unit has 118 in total across 23 steps.

  • Odd one outLevel 2

    1. Three of these are output devices. Which one does NOT belong?

    • Keyboardcorrect
    • Monitor
    • Speaker
    • Printer

    A keyboard is an input device, while monitors, speakers and printers are outputs.

  • Multiple choiceLevel 2

    2. What is the name for the slots on a motherboard where RAM sticks are inserted?

    • Memory slotscorrect
    • Speakers
    • Fans
    • Pixels

    RAM sticks slide into memory slots on the motherboard.

  • Put in orderLevel 2

    3. Put these data sizes in order from smallest to largest.

    Answer: Kilobyte -> Megabyte -> Gigabyte -> Terabyte

    A kilobyte is smallest, then megabyte, gigabyte, and a terabyte is largest.