RAM and storage

Random-access memory (RAM) is the computer's working memory: it holds the operating system, the programs that are running and the data they are working on right now. "Random access" means any address can be read in the same short time, in any order. RAM is volatile: it keeps its contents only while it has power.

Storage (SSDs and hard drives) is non-volatile: it keeps data without power, but is much slower. So the two work together. When you open a program, it is copied from storage into RAM, and the CPU works from RAM. When you save a document, it is written from RAM back to storage. Anything not yet saved is lost at a power failure.

RAM Storage (SSD, HDD)
Without power Loses its contents (volatile) Keeps its contents (non-volatile)
Access time Tens of nanoseconds Microseconds (SSD) to milliseconds (HDD)
Typical size in a PC 8–64 GB 256 GB to several TB
Holds What is running now Everything that is installed and saved

More RAM does not make each program faster; it lets more programs and larger files stay in fast memory at the same time. When RAM runs out, the system has to use storage instead, and that is when it becomes slow. Storage is covered in Storage.

How DRAM works

The memory in modules is dynamic RAM (DRAM): each bit is stored as an electrical charge in a tiny capacitor, switched by one transistor. That makes a bit very small and cheap, which is why gigabytes fit on one module. The price is that the charge leaks away within milliseconds. The memory must therefore refresh every row regularly, reading and rewriting it; the standards require each cell to be refreshed every few tens of milliseconds (64 ms for DDR4, 32 ms for DDR5) at normal temperatures. "Dynamic" refers to this constant refreshing, and it is why DRAM is volatile.

Static RAM (SRAM), used for the CPU's cache, stores each bit in a circuit of about six transistors. It needs no refresh and is much faster, but takes far more space per bit, so it is used only in megabytes.

Memory modules

DRAM chips are mounted on small circuit boards called modules, which plug into slots on the motherboard.

  • A DIMM (dual inline memory module) is the standard memory module for desktops, workstations and servers. "Dual inline" means the contacts on the two sides of the module carry different signals. A DDR4 or DDR5 DIMM is about 133 mm long with 288 contacts.
  • An SO-DIMM (small outline dual inline memory module) is a shorter module, about half the length of a DIMM, for laptops, mini PCs and some all-in-ones. It is installed at an angle and then pressed down flat.

Many thin laptops and all Apple silicon Macs have no slots at all: the memory is low-power DDR (LPDDR) soldered to the board or placed in the processor package, and cannot be upgraded. Some recent laptops use Compression Attached Memory Module 2 (CAMM2), a newer flat module standard. Check which kind a laptop has before promising a user more memory.

DDR generations

Memory modules today use double data rate synchronous DRAM (DDR SDRAM): data is transferred on both the rising and the falling edge of the clock signal, so twice per clock cycle. Each generation raises the speed and lowers the voltage. DDR5, the fifth generation, is the current standard for new desktops and laptops. Compared with DDR4 it starts at higher speeds, splits each module into two independent 32-bit subchannels, and moves voltage regulation onto the module itself.

Generation Voltage Standard speeds (JEDEC) DIMM / SO-DIMM contacts
DDR3 1.5 V (DDR3L: 1.35 V) 800–2133 MT/s 240 / 204
DDR4 1.2 V 1600–3200 MT/s 288 / 260
DDR5 1.1 V 4800 MT/s and up (up to 8800 in JESD79-5C, at the time of writing) 288 / 262

The generations are not interchangeable. Each has the notch in its edge connector at a different position, so a module physically will not go into a slot of another generation. That is deliberate: the voltages and signals differ, and the wrong module could be damaged. A board supports exactly one generation (a few older boards had slots for two, of which only one set could be used).

JEDEC, the standards body for memory, defines the standard speeds. Modules sold as faster than that, such as DDR4-3600 or DDR5-6000, store an overclocking profile, Intel Extreme Memory Profile (XMP) or AMD Extended Profiles for Overclocking (EXPO). Until that profile is switched on in the firmware, the modules run at a standard, slower speed.

MT/s versus MHz

A module's speed is its transfer rate in megatransfers per second (MT/s): DDR4-3200 performs 3,200 million transfers per second on each data line. Because DDR transfers twice per clock cycle, its input/output (I/O) clock is half that: 1600 MHz. Marketing and many tools nevertheless write "3200 MHz". Both refer to the same module; do not let a tool that reports 1600 MHz convince you the memory runs at half speed.

A second name comes from the peak bandwidth in MB/s: DDR4-3200 is also sold as PC4-25600, DDR3-1600 as PC3-12800. The number is simply the transfer rate times 8 bytes.

CAS latency

Column address strobe (CAS) latency, written as CL16 or CL40, is the number of clock cycles between asking for a piece of data and receiving it. Higher-speed memory has shorter cycles, so a higher CL number is not automatically slower. What counts is the time:

# First-word latency in nanoseconds: CAS latency cycles x cycle time.
# The I/O clock runs at half the transfer rate (two transfers per clock).
for name, mts, cl in [("DDR4-3200", 3200, 16), ("DDR5-4800", 4800, 40), ("DDR5-6000", 6000, 30)]:
    clock_mhz = mts / 2
    ns = cl / clock_mhz * 1000
    print(f"{name} CL{cl}: clock {clock_mhz:.0f} MHz, latency {ns:.2f} ns")
DDR4-3200 CL16: clock 1600 MHz, latency 10.00 ns
DDR5-4800 CL40: clock 2400 MHz, latency 16.67 ns
DDR5-6000 CL30: clock 3000 MHz, latency 10.00 ns

CAS latency is only one part of a memory access. A complete read, as the CPU experiences it, takes about 50–100 ns (see the memory hierarchy in CPUs).

Latency has stayed roughly the same over the generations while bandwidth has grown a lot. For everyday work the difference between memory kits is small; capacity and running in dual channel matter more.

Memory channels

The memory controller in the CPU talks to the modules over channels: independent 64-bit paths that can each transfer data at the same time. In dual channel mode the controller uses two channels at once, with at least one module on each, which doubles the peak bandwidth compared with one channel. Almost all desktop and laptop platforms have two channels; workstation platforms have four (quad channel) or more, and server processors eight or more.

The CPU's memory controller has two channels, A and B, with two slots each. Two modules are installed, one in slot A2 and one in slot B2, so both channels are used; slots A1 and B1 are empty. CPU memory controller Channel A Channel B A1 empty A2 16 GB module B1 empty B2 16 GB module
Two modules, one per channel: dual channel. Two modules in A1 and A2 would both sit on channel A and run in single channel. Which slots to fill first differs per board (A2 and B2 is common); the manual and the slot labels say.

Peak bandwidth is easy to calculate: the transfer rate times 8 bytes (the 64-bit width of a channel) times the number of channels.

BUS_BYTES = 8   # one memory channel is 64 bits (8 bytes) wide

def peak_gbs(mts, channels):
    """Peak bandwidth in GB/s: transfers per second x bytes per transfer x channels."""
    return mts * 10**6 * BUS_BYTES * channels / 10**9

for name, mts in [("DDR4-3200", 3200), ("DDR5-5600", 5600)]:
    for channels, mode in [(1, "single"), (2, "dual")]:
        print(f"{name} {mode:<6} channel: {peak_gbs(mts, channels):5.1f} GB/s")

print(f"DDR4-3200 modules are sold as PC4-{3200 * BUS_BYTES}")
DDR4-3200 single channel:  25.6 GB/s
DDR4-3200 dual   channel:  51.2 GB/s
DDR5-5600 single channel:  44.8 GB/s
DDR5-5600 dual   channel:  89.6 GB/s
DDR4-3200 modules are sold as PC4-25600

These are theoretical peaks; real throughput is lower. A DDR5 module's two 32-bit subchannels together are still 64 bits wide, so the formula holds. The practical lesson: a single 16 GB module gives half the bandwidth of two 8 GB modules. That matters most for integrated graphics, which use system RAM as video memory.

For dual channel, use identical modules (same size, speed and timings, ideally one kit) in the slots the manual names. Mixed modules usually work, but run at the speed of the slowest one, and modules of different sizes may run only partly in dual channel.

How much memory is enough

There is no single right answer: it depends on the operating system, the applications and how many run at once. As rough guidance at the time of writing, for a Windows 11 PC:

  • 8 GB: a practical minimum for light use such as email and a browser with a few tabs. Windows 11 officially needs 4 GB, but runs poorly with it.
  • 16 GB: comfortable for office work with many browser tabs, video calls and several programs open.
  • 32 GB or more: for photo and video editing, software development with virtual machines or containers, large data sets and many current games.

The best evidence is the machine itself: if Task Manager shows the memory nearly full during normal work, and the drive busy, more RAM will help. If there is plenty free, it will not.

ECC memory

A bit in memory can occasionally flip because of electrical problems, a weak cell or even cosmic radiation. On a desktop that might cause one crash in a long time; on a server with hundreds of gigabytes running for years, it causes silent data corruption. ECC (error-correcting code) memory stores extra check bits with the data (8 per 64 bits on DDR4, 8 per 32-bit subchannel on DDR5). With them, the memory controller corrects any single-bit error on the fly and detects (but cannot correct) a two-bit error, which it reports so the system can stop instead of using wrong data.

  • ECC needs support from the CPU and motherboard, not only ECC modules. It is standard on servers and workstations and rare on consumer PCs.
  • Server memory is also usually registered (RDIMM): a register chip on the module buffers the signals, so a channel can carry more modules. Registered modules do not work in boards that take ordinary unbuffered modules (UDIMMs), and the other way round.
  • DDR5 chips have "on-die ECC" inside each chip. That only protects data stored in the chip; it is not the same as ECC memory, which also protects the data on its way to the CPU.

Virtual memory

Virtual memory is a technique in which the operating system gives each program its own address space and maps it onto physical RAM, using storage as an overflow when RAM is full. Parts of memory that have not been used recently are moved out to a file on the drive, the page file (pagefile.sys) on Windows or the swap space on Linux and macOS, and brought back when needed. Programs keep running when RAM runs out, but storage is thousands of times slower than RAM.

A system that constantly moves memory back and forth is thrashing: the drive is busy, everything responds slowly, and switching between programs takes seconds. The real fix is more RAM or fewer programs at once, not a larger page file. On Linux, free -h shows how memory and swap are used (illustrative output for a machine with 16 GB installed):

free -h
               total        used        free      shared  buff/cache   available
Mem:            15Gi       4.8Gi       6.1Gi       412Mi       4.3Gi        10Gi
Swap:          4.0Gi          0B       4.0Gi
  • total 15Gi: 16 GB installed, shown in binary units and minus memory reserved for firmware and integrated graphics.
  • available 10Gi: what programs can still get; Linux uses free memory as disk cache (buff/cache) and gives it back when needed, so a low free value alone is no problem.
  • Swap used 0B: nothing has had to move to the drive, so this machine has enough RAM for its current work.

How operating systems manage memory is part of the Operating Systems topic.

Installing and troubleshooting memory

Installing memory

  1. Check compatibility: generation (DDR4 or DDR5), DIMM or SO-DIMM, the maximum capacity per slot and in total, and the board's or laptop's support list.
  2. Shut down, unplug the power (and on a laptop, disconnect the battery if it is removable or the service manual says so), and ground yourself with an antistatic wrist strap. Hold modules by the edges, never by the gold contacts. See Safety and Handling.
  3. Desktop: open the latches, line up the notch with the key in the slot, and press the module straight down firmly until the latches click. Laptop: insert the SO-DIMM at an angle of about 30 degrees and press it down until the side clips lock.
  4. Use the slots the manual names for dual channel, in matched pairs.
  5. Start the computer and check that the firmware and the operating system report the full capacity and the expected speed; switch on XMP or EXPO if the modules are rated above the standard speed.

On DDR5 systems in particular, the first start after changing memory can show a black screen for a minute or longer while the board trains the memory. Wait before concluding that it is dead. To check what is installed on Windows:

Get-CimInstance Win32_PhysicalMemory | Select-Object DeviceLocator, Capacity, ConfiguredClockSpeed
DeviceLocator    Capacity ConfiguredClockSpeed
-------------    -------- --------------------
DIMM_A2       17179869184                 5600
DIMM_B2       17179869184                 5600

Illustrative output: two modules in slots A2 and B2 (dual channel), each 17,179,869,184 bytes (16 GiB, sold as 16 GB), running at 5600 MT/s (the property says "clock speed", but on current systems it reports the MT/s figure). Task Manager's Performance tab shows the same, including the slots used.

Symptoms of bad memory

Faulty or badly seated memory produces problems that look random, because different data lands in the bad location each time:

  • Random crashes, freezes and restarts, especially under load.
  • Stop errors (blue screens) with changing error codes, often mentioning memory management or page faults.
  • Corrupted files, failing installations or updates.
  • No start at all: beep codes, a memory warning light on the board, or no picture.
  • Less memory reported than installed: a module is not seated, faulty, or not supported by the board.

To confirm, run a memory test: Windows Memory Diagnostic (mdsched.exe) or MemTest86 from a USB stick. Then isolate: reseat the modules, and test with one module at a time to find the bad one. The full method is in Hardware Troubleshooting.