Computer Memory and Storage
Computer Memory and Storage Hierarchy
Computers use many kinds of memory and storage because no single technology combines large capacity, low cost, fast access, and high bandwidth. Instead, systems combine technologies with different strengths and move data among them so that frequently needed information is available quickly while large amounts of data remain affordable.
Applications and files are stored persistently on solid-state drives (SSDs) or hard disk drives (HDDs). When an application or game runs, relevant data is transferred into working memory and then into progressively faster locations near the processors, including DRAM, graphics-card memory, CPU caches, and registers. The CPU and GPU can operate efficiently only when needed data reaches these nearby locations.
Why computers use many memory locations
Each type of memory or storage has different characteristics:
Capacity: How much data the location can hold.
Access time: How long it takes to retrieve requested data.
Bandwidth: How much data can be transferred per unit of time.
Cost: How expensive it is to provide a given amount of storage.
Hard drives and SSDs can store large amounts of data at relatively low cost, but they have much longer access times than processor memory. CPU registers and caches respond extremely quickly and provide high bandwidth, but their capacities are small and their cost per bit is high.
A computer’s memory hierarchy combines technologies so that large, relatively inexpensive storage can work together with smaller, faster memory.
Memory controllers and algorithms move data between these levels. Without this arrangement, applications would either take a very long time to load and run or would have to use much simpler, less data-intensive workloads.
Capacity, access time, and bandwidth
Capacity is the total amount of data that can be stored.
Access time, or latency, is the delay before requested data becomes available.
Bandwidth is the rate at which data can be transferred once transfer is underway.
These properties are related but not interchangeable. For example, a device can provide high bandwidth while still having significant latency for an individual request.
Comparing the scale of the hierarchy
A library analogy helps illustrate the large differences between memory levels:
A megabyte can be represented as approximately 400 pages of text. If each letter, punctuation mark, or space is treated as an 8-bit character, this is close to one megabyte.
In the analogy, 20 centimeters represents one nanosecond of access time.
The distance from a processor to a storage location represents delay, not simply the distance electricity must travel.
CPU registers and cache
The CPU can be pictured as a table in a library. Registers and three cache levels provide places to keep books or pages that the CPU may need immediately.
Registers and the L1 and L2 caches are divided among individual CPU cores.
The L3 cache is shared among the cores.
In the example system, the CPU has 8 performance cores and 16 efficiency cores.
Registers and caches together hold about 68 megabytes, including smaller amounts in the registers and L1 caches.
Approximately 30% of the CPU die is devoted to cache and register storage; much of the remaining area contains execution logic, controllers, and other circuitry.
Registers are extremely close to the arithmetic logic unit (ALU) and execution units. Their access time is roughly one-third of a nanosecond.
The shared 36-megabyte L3 cache is farther from the execution units in the analogy, corresponding to an access time of about 7.5 nanoseconds.
DRAM
DRAM can be pictured as library carts beside the CPU’s table.
Two 16-gigabyte DRAM modules provide 32 gigabytes in total—about 470 times the capacity of the CPU’s approximately 68 megabytes of registers and cache.
CPU-to-DRAM access time is around 45 nanoseconds.
In the distance analogy, the DRAM carts are roughly 9 meters from the CPU table.
GPU and VRAM
A graphics card contains a GPU and its own memory, called video RAM (VRAM).
A GPU has many cores—around 10,000 in the example—and therefore organizes its nearby memory differently from a CPU.
The GPU’s registers and L1 and L2 caches together hold about 37 megabytes.
The example VRAM capacity is 24 gigabytes.
VRAM access time is approximately 250 nanoseconds. Its design emphasizes high bandwidth, using wide data paths and deep pipelines rather than minimizing the latency of an individual request.
A CPU-to-GPU data transfer may take around 300 nanoseconds on average, a substantial delay compared with access to on-chip memory.
SSDs and HDDs
Storage devices have much larger capacities but far longer access times.
An example NVMe SSD holds data equivalent to about 2 million books.
An example SATA SSD holds about 4 million books.
An example HDD holds about 8 million books.
NVMe and SATA SSD access times are approximately 80 and 120 microseconds, respectively.
An HDD may take about 10 milliseconds to access data. In the analogy, those SSD and HDD delays correspond to distances of roughly 16 kilometers, 24 kilometers, and 2,000 kilometers.
Internet and cloud storage
Network and cloud systems add another level to the broader hierarchy.
The internet contains enormous amounts of data; the illustrative estimate is about 500 exabytes.
Network latency depends on how far the request and response must travel, as well as on the network path.
A round trip to a nearby city may take around 12 milliseconds.
A request traveling to the other side of Earth and back may take about a quarter of a second.
Remote systems can offer vast capacity, but network delays make them much slower to access than local memory and storage.
The memory hierarchy
A standard way to organize memory and storage is as a memory hierarchy:
Registers and cache are closest to the processor. They are the smallest, fastest, and most expensive per bit.
DRAM serves as main memory. It has much greater capacity than cache but longer access time.
SSDs and HDDs provide persistent, high-capacity storage at lower cost per bit, but with much longer access times.
Network and cloud storage provide access to vast remote datasets, with latency dependent on network distance and conditions.
Moving down the hierarchy generally increases capacity and reduces cost per bit, while increasing access time. Data is moved closer to the processor when it is needed. Ultimately, data must be in registers for the execution units to perform calculations on it.
Solid-state drives and 3D NAND flash
An SSD stores files in semiconductor memory rather than on a moving disk. An example 2-terabyte NVMe SSD has a circuit board containing a memory controller, DRAM, and 3D NAND flash packages.
Structure of a 3D NAND package
A flash package contains a stack of semiconductor dies connected by wires to a substrate. Each die contains multiple planes, and each plane contains a very large array of memory cells.
An illustrative plane may contain:
Tens of thousands of strings across.
Tens of thousands of rows.
Roughly 200 layers of cells.
An array of this kind can store more than 100 gigabytes in a volume smaller than a grain of rice. High density helps make flash storage inexpensive per gigabyte.
Charge-trap flash cells
A common flash-memory cell is a charge-trap flash (CTF) cell. It stores data by retaining electrons in an insulated region called a charge trap.
The charge trap can hold several distinct charge levels.
In the example, eight charge levels represent 3 bits per cell.
An insulating dielectric surrounds the trapped charge, allowing data to remain stored for years without external power.
Because the charge trap has no direct electrical connection, reading or changing its charge requires a sequence of carefully controlled voltage steps.
These physical requirements make flash slower to access than DRAM or cache. An illustrative NVMe SSD has a read time around 80 microseconds, a write time closer to 500 microseconds, and bandwidth around 5 gigabytes per second.
Access time is largely determined by the flash cells and the circuitry needed to operate them. Placing a CPU physically next to the cells would not make flash respond as quickly as cache. In the library analogy, this is like the time and effort required to reach a book on a difficult or very tall shelf, rather than simply the distance the request travels.
NVMe and SATA SSDs
NVMe and SATA SSDs use similar NAND flash technology and can have comparable underlying storage costs. Their performance differs partly because of their interfaces:
NVMe SSDs use a newer protocol designed for fast communication with storage.
SATA SSDs are constrained by an older data-transfer protocol, resulting in longer access times and substantially lower bandwidth than NVMe, even though both types use flash memory.
Hard disk drives
An HDD stores data magnetically on rotating platters.
Mechanical structure and data organization
A hard drive contains a stack of platters and read-write heads controlled by a voice-coil motor. In the illustrative drive:
Four platters are served by eight read-write heads.
Data is arranged in concentric circles called tracks.
Tracks are divided into sectors.
A sector contains synchronization information, an address, data (for example, 4 kilobytes), an error-correcting code, and gaps separating sectors.
Magnetic recording
The write head creates focused magnetic fields that change the orientation of tiny magnetic domains on the platter. When reading, the head detects changes in magnetic fields:
A change represents a binary 1.
No change represents a binary 0.
Trillions of bits can be recorded across a platter, allowing a single drive to store terabytes of data.
HDD strengths and limitations
Low cost per capacity: Platters are layers of material on disks rather than complex semiconductor structures. HDD storage can cost only a cent or two per gigabyte.
Mechanical access delay: The read-write head must move to the correct track, and the platter must rotate until the required sector passes beneath the head.
Lower bandwidth and longer access time: Seeking and waiting for rotation make HDDs much slower than semiconductor memory and SSDs for individual requests.
A platter rotating at 7,200 revolutions per minute completes one rotation in approximately 8.3 milliseconds. This illustrates why rotational delay contributes significantly to HDD access time.
DRAM as main memory
Dynamic random-access memory (DRAM) is the main memory used to hold data and instructions needed by active programs. Memory modules connect to the CPU through motherboard memory channels, and the CPU’s memory controller manages access.
DRAM chip structure
A DRAM chip contains interconnection layers and multiple banks. In the example, a chip has 32 banks, each containing an array of roughly 65,000 rows by 8,000 memory cells.
Each DRAM cell uses one transistor and one capacitor, often abbreviated as a 1T1C cell:
The capacitor stores one bit as electrical charge.
The transistor acts as a switch that allows the cell to be accessed.
Reading and writing DRAM
To access data, the memory controller supplies an address identifying a bank and row. The row’s transistors are activated, connecting the capacitors to sense amplifiers. The amplifiers detect the voltage associated with each capacitor’s charge. Read and write circuitry then transfers data between the memory and the CPU.
The example access time is about 45 nanoseconds. DRAM can also provide high bandwidth; a typical figure given is around 48 gigabytes per second. High bandwidth helps the system move data quickly, including when the operating system switches between active processes.
DRAM trade-offs and volatility
DRAM’s capacitors occupy physical area, so DRAM cells are generally arranged in a two-dimensional plane. This limits bit density and raises cost per bit relative to some storage technologies.
The capacitor also loses charge over time. DRAM must therefore be refreshed frequently to preserve its contents. Without power, it loses stored data very quickly—on the order of a tenth of a second in the illustrative description—so DRAM is volatile memory.
CPU cache and registers
Cache and registers are built from transistors, giving them very low access times and high bandwidth. Their speed and complexity make them expensive and limit their capacity.
Cache memory: SRAM
CPU cache commonly uses static random-access memory (SRAM) cells made from six transistors per bit.
The example CPU has about 36 megabytes of L3 cache.
At six transistors per bit, this cache alone requires roughly 1.8 billion transistors.
Adding other cache levels and the circuitry needed to identify and manage stored data makes cache a substantial portion of the CPU die—approximately one-third in the example.
Increasing cache to a gigabyte would require an enormous number of additional transistors and greatly increase cost. This is why cache remains much smaller than main memory and storage.
Registers: D flip-flops
Registers hold data that the processor is using immediately. They are built from D flip-flops, with approximately 16 transistors per bit in the example.
A typical register is 64 bits wide, and a processing core may have 32 register entries in its register file. Register files remain small for two main reasons:
Access speed and circuitry: Registers are designed to be accessed in a single clock cycle. Adding more entries requires larger decoder circuitry and more access ports. That extra circuitry can make it harder to maintain a high clock speed.
Instruction encoding: In the example, an instruction uses 5 bits to specify one of 32 registers. More registers would require more bits in the instruction, making instructions longer.
How processors use registers and caches
The ALU and execution units perform calculations on data in registers. If the required data is not already there, it must be fetched through the hierarchy:
The processor checks its nearby registers and caches.
If needed, it obtains the data from main memory.
If the data is not in main memory, it must be loaded from storage.
The data moves toward the processor and ultimately into registers before the execution units can use it.
This staged movement allows the processor to work quickly while the system retains far more data than could fit in registers and cache alone.
Approximate specifications and other memory technologies
The sizes and access times used in comparisons are illustrative rather than exact. Manufacturers do not always publish all internal specifications, and products differ in their designs. For example, described NAND-plane dimensions are intended to represent a realistic scale, not serve as a precise blueprint.
Many designs exist within each category, and technology continues to change. Future devices may offer greater capacity, faster access, and higher bandwidth. Other memory technologies include magnetic RAM and phase-change memory, as well as emerging variants of existing types.
Memory and storage for AI systems
AI servers and data centers can require far more memory and storage than desktop computers. A single AI server may contain terabytes of memory and hundreds of terabytes of storage. This demand comes from both the size of AI models and the large internal representations used to process input.
Why AI uses more data than the text itself
A paragraph’s ordinary character encoding may occupy only a small number of bytes, but AI systems transform input into richer internal representations.
A simplified explanation treats each word as one token. In practice, a token can be a whole word or only part of one. The example assumes each token is represented by about 8,000 dimensions or values, with each value occupying one byte.
These dimensions are numerical features that help represent a token and its relationships to other concepts. For example, a representation of “dog” could include values that contribute to distinctions involving attributes such as size or temperature. This is a simplified illustration; the dimensions are not necessarily literal, human-readable labels.
At 8,000 one-byte values per token, one token’s representation takes about 8 kilobytes. A model’s context window is the maximum amount of token context it can handle at once. It can include:
The user’s input.
Earlier conversation.
Reference material.
The model’s generated response.
For a context window of one million tokens, the simplified representation requires about 8 gigabytes, before accounting for other data and computation involved in running the model.
Transformer computation and model parameters
To generate a response, the context is processed through many transformer blocks. These may contain:
Attention sublayers, which help the model relate information across tokens.
Feed-forward or multilayer perceptron blocks, which transform representations within the network.
Mixture-of-experts components, which select or combine specialized parts of a model.
Other supporting components.
Each block contains learned parameters, and state-of-the-art models may contain hundreds of billions of parameters. As the context passes through the blocks, the system must repeatedly store, retrieve, and move large quantities of numerical data to and from the AI processors. AI workloads therefore place exceptional demands on memory capacity, bandwidth, and storage.
The AI memory hierarchy
AI systems use the same general principle as desktop computers—a hierarchy of storage levels—but at a much larger scale. Memory closest to the AI processor provides fast, high-bandwidth access, while larger capacity is supplied by progressively more distant memory and storage.
High-bandwidth memory near the processor
High-bandwidth memory (HBM) is placed close to the AI processor to provide a fast path for data.
An example HBM3E package uses a stack of 12 DRAM dies connected by through-silicon vias (TSVs). These vertical connections link the stacked layers, creating a compact, dense memory package.
In the example system:
Six HBM packages are mounted around an AI processor.
The processor and HBM sit on an interposer, a thin silicon substrate that functions like a dense wiring bridge or mini-motherboard.
The arrangement provides 141 gigabytes of HBM.
Short, very wide connections deliver about 1.2 terabytes per second of bandwidth with low latency.
The design combines proximity with very wide connections so that HBM can supply large amounts of data rapidly.
DDR5 server memory and expansion memory
A lower level in the AI memory hierarchy uses DDR5 registered DIMMs (RDIMMs) as server main memory.
An example server has 32 sticks.
Each stick contains 128 gigabytes.
Together, they provide 4 terabytes of memory.
Some AI systems use LPDDR, a low-power DRAM technology also used in devices such as phones. It can offer high bandwidth while using power efficiently.
Servers can expand memory capacity further using Compute Express Link (CXL), a protocol for connecting additional memory resources. These levels extend available capacity beyond the memory located closest to the AI processor.
SSDs and data-center storage
AI systems also require large persistent storage for model data, software, and training datasets.
SSDs inside an AI server chassis may provide between 8 and 30 terabytes each.
Advanced SSDs can use high-speed interfaces such as PCIe Gen6 to support the throughput demands of training and inference.
Separate data-storage racks can use networked NVMe SSDs. An example module may provide up to 122 terabytes, while other form factors can reach 246 terabytes.
Depending on chassis design and drive density, a rack can hold tens to hundreds of petabytes.
This capacity can support very large datasets, including training collections containing billions of examples.
Key relationships to remember
Registers and cache are small and fast, enabling immediate processor work.
DRAM provides much greater working capacity but must be refreshed and loses data without power.
VRAM and HBM provide memory close to graphics or AI processors, with designs emphasizing high bandwidth.
SSDs store persistent data densely in flash cells; their access time is limited by the physical operation of those cells and their control circuitry.
HDDs provide high capacity at low cost but require mechanical seeking and rotation, making access much slower.
Cloud and network storage can provide enormous capacity, but access time depends on communication over a network.
A system’s performance depends not only on how much data it can store, but also on how effectively it moves the right data to the processor at the right time. Each level of the hierarchy balances capacity, speed, bandwidth, persistence, and cost.

Ask anything
We've read this whole study set, so questions about it get the best answers.