Follow
Subscribe via Email!

Enter your email address to subscribe to this platform and receive notifications of new posts by email.

Virtual Memory: How Operating Systems Map Programs to RAM

Virtual memory lets operating systems and CPU hardware translate program addresses into RAM and disk locations, isolating processes while hiding memory fragmentation.
A diagram showing colored hexadecimal virtual address blocks mapping with arrows to physical memory and disk.

Virtual memory lets an operating system and CPU hardware translate the memory addresses a program uses into real locations in RAM and disk storage. Each running program sees a clean, contiguous block of addresses even when its data sits scattered across separate RAM chips or spills onto a drive [1, 3]. Unlike high-bandwidth memory stacks, which boost throughput by packing DRAM dies vertically in hardware, virtual storage is an addressing layer managed by the kernel and processor together. It isolates processes from one another, lets libraries share code safely, and removes the need for programmers to juggle overlays by hand [1].

How Address Translation Works

Every time a program reads or writes a byte, it sends a virtual address rather than a real chip coordinate [1, 2]. A circuit inside the CPU called a memory management unit (MMU), sometimes called a paged memory management unit (PMMU), intercepts that request and converts it into a real RAM address [2, 3]. Software can set up virtual address spaces as wide as the CPU architecture allows—32 or 64 bits—even when the machine holds far less RAM. Programs rarely touch all of their allocated space at once, so the system only needs to keep active pieces in main memory [2].

Hardware divides that virtual address space into equal-sized blocks called pages. Each page holds 2^N bytes, typically at least 4 kilobytes, though systems with huge address ranges or large RAM pools often choose bigger pages [1, 3]. Splitting an address into two parts keeps translation fast. The lower N bits form the offset inside the page and pass straight through unchanged, while the upper bits carry the virtual page number that the MMU looks up [3].

Because contiguous virtual pages can point to scattered frames in RAM, the operating system hides fragmentation from software [1, 3]. Two separate programs can even use identical virtual addresses without colliding, because the hardware maps each process to its own corner of RAM [2, 3]. While ECC memory circuits protect data inside the chips from single-bit errors, the MMU enforces isolation by blocking any program from reading or changing memory it did not request [2].

Sharing segments across processes in Multics virtual memory
Segment sharing between two processes in the Multics execution environment. (Credit: Multicians.org)

Page Tables and Page Faults

To track which virtual page lives in which RAM frame, the MMU reads a data structure called a page table. Each page table entry (PTE) stores a flag showing whether that page is currently in main memory, along with the matching real page number if it is [1, 3]. A PTE can also record whether the page has been written to, when it was last touched for least recently used replacement, whether user or supervisor code may read or write it, and whether the CPU should cache it [3].

When a program touches a virtual page whose PTE shows it is absent from RAM, the MMU triggers a page fault interrupt to the CPU [1, 3]. The operating system’s paging supervisor takes over, locates a free frame in RAM, and copies the missing page from backing storage such as a hard drive [1, 2]. If no frame is free, the kernel picks a lesser-used page via a replacement algorithm, writes it out to disk if it was modified since loading, updates the PTE to point to the new RAM location, and resumes the program [2, 3]. This cycle is called demand paging [2].

Systems organize page tables in several ways. An operating system may maintain one table for the entire machine, one per process, one per segment, or a tree of region tables [1, 3]. If all tasks share a single table, each running application occupies a separate slice of one shared virtual address range [1]. Per-process tables let the kernel switch mappings during a context switch so every program starts from the same virtual layout without load-time relocation [3].

Hardware Behind the MMU

Early microprocessors did not include address translation circuits on the main silicon die. Instead, board designers wired a separate MMU chip alongside the processor—wait, no, let us look at the exact pairings. The Motorola 68851 (1984) handled translation for the Motorola 68020 inside the Macintosh II, while the Zilog Z8010 and Z8015 (1985) served the Zilog Z8000 and Z80 families [2, 3]. VLSI Technology also shipped the VI475 in 1986, and Motorola offered the 68451 for segmented layouts [2].

Later chips folded the MMU onto the CPU die itself. The Motorola 68030, the Zilog Z280, and the Intel 80286 and subsequent x86 processors all integrated address translation directly into the processor package [2, 3]. Earlier 16-bit x86 chips—the Intel 8086, Intel 8088, Intel 80186, and Intel 80188—lacked real protection. Their 16-bit segment registers addressed 65,536 overlapping segments of 64 KiB each within a 1 MiB ceiling, with no bounds checks to stop one program from overwriting another. Some 16-bit PDP-11 minicomputers took a cleaner path, using Page Address Registers and Page Description Registers to map 16-bit virtual addresses into 18-bit or, on the PDP-11/70, 22-bit real addresses [2].

Instruction using an ITS pointer in Multics memory addressing
How a Multics instruction resolves an ITS pointer pair across segments. (Credit: Multicians.org)

Not every computer uses an MMU. Simple real-time operating systems and embedded controllers often skip virtual memory because address-translation hardware eats significant chip area and page faults introduce unpredictable delays when data must come from disk [1, 2]. Those systems rely on a simpler hardware memory protection unit instead [2].

Segmentation

Before paging became the universal default, many systems divided memory into variable-length chunks called segments [2, 4]. In segmented translation, an address carries a segment number and an offset inside that segment. The hardware reads a segment table entry containing the base address in main memory, the segment’s length, and read, write, or execute permissions. Storing just a base and limit value kept the hardware simple, and segments matched logical pieces of a program such as code or data arrays [2, 4].

Variable sizing brought a stubborn flaw known as external fragmentation. As programs started, stopped, and freed segments of different lengths, free RAM broke into scattered pockets. Even when enough total bytes sat unused, no single gap could fit a large incoming segment without copying existing segments around in RAM and rewriting their table entries [2].

Intel’s x86 line showed how hard pure segmentation was to scale. Protected mode on the Intel 80286 swapped whole segments, which bogged down as segments grew. In 1985’s era successor, the Intel 80386 placed paging underneath the existing segmentation layer so page faults could chain cleanly without causing a double fault. Because loading segment descriptors remained slow, operating system writers largely bypassed segmentation and built on paging alone [1]. Earlier machines like the Burroughs B5000 used pure segmentation, whereas the Honeywell 645 and IBM System/360 Model 67 paired segmentation with paging so only a few pages of a few segments needed to stay in core memory at once [4].

Snapped link inside a Multics linkage section
A snapped inter-segment link in the Multics runtime environment. (Credit: Multicians.org)

Inside Multics Virtual Memory

Starting in 1965, the Multics operating system (Multiplexed Information and Computing Service) treated segmentation and paging as one unified virtual memory system. Designed across MIT, Bell Labs, and General Electric—with A. Bensoussan, C. T. Clingen, and R. C. Daley documenting the architecture in their 1968 CACM paper and subsequent Honeywell reports—Multics ran first on the GE-645 before moving to the 6180 and Level 68 hardware [4, 5]. Memory was scarce and costly then: the GE-645 held 1.5 MB of core memory (384K words), compared with two banks of 32K words on the older 7094 [5].

Each Multics process—a term Jerry Saltzer’s ScD thesis defined as “a locus of control plus an address space,”—addressed memory in two dimensions: a segment number and an offset up to 262,144 words (1 MB). The CPU’s Descriptor Segment Base Register pointed to a table of Segment Descriptor Words holding a page-table address, length bounds, read/write/execute bits, and ring brackets. Programs referenced other segments either through base registers such as lp and sp or through in-memory ITS pointer pairs flagged by octal 43 in their indirection bits [5].

Because the hardware checked permissions on every segment reference, Multics let users share code and files straight from memory without copying buffers back and forth like CTSS did [4]. Pure procedure code stayed read-and-execute only, while each process kept its own writable linkage section and stack. Hardware rings from 0 (the hardcore supervisor) out to ring 4 (user data) and ring 5 (used at Calgary for time-limited FORTRAN jobs) enforced strict isolation, as Melanie Weaver later detailed in her March 1987 B2 certification guide MDD-020 [5].

Unsnapped link before resolution in a Multics process
An unsnapped link inside a Multics procedure linkage section. (Credit: Multicians.org)

From Manual Overlays to Virtual Memory

In the 1950s and 1960s, core memory cost so much that large programs could not fit in RAM at once. Programmers had to write explicit overlay code to shuttle chunks between main store and spinning drums, then recompile whenever memory size changed. Working paging prototypes existed by 1959 at the University of Manchester, where the Atlas Computer—commissioned in 1962—built the first true virtual memory system. Atlas mapped programmer addresses across 16,384 words of primary core memory and 98,304 words of secondary drum memory under the Atlas Supervisor [1].

A common claim credits German physicist Fritz-Rudolf Güntsch’s 1956 Technische Universität Berlin thesis, Logical Design of a Digital Computer with Multiple Asynchronous Rotating Drums and Automatic High Speed Memory Operation, with inventing virtual memory. Careful checks reject that view because his proposed 105-word address space mapped 1-to-1 onto drum words with no indirect translation. Güntsch actually described cache memory, writing in translation: “The programmer need not respect the existence of the primary memory (he need not even know that it exists), for there is only one sort of addresses [sic] by which one can program as if there were only one storage.” That mirrored the IBM System/360 Model 85, whose hidden semiconductor cache held copies of real core addresses [1].

Commercial adoption accelerated after Robert S. Barton proposed automatic allocation at Shell Research in 1958 and led the Burroughs B5000 project alongside W. R. Lonergan, Donald Knuth, and Paul King. After King heard Stan Gill present Manchester’s Atlas I design at a May 1960 UCLA seminar, Burroughs released the B5000 with MCP in 1964 as the first commercial machine with virtual memory. Skeptics doubted system-wide paging could beat hand-tuned overlays until 1969, when David Sayre’s IBM research team showed their virtual overlay system consistently beat the best manual code. Soon mainframes like IBM’s System/360 Model 67, RCA’s Spectra 70/46, IBM’s System/370 (with VM/370 in 1972 and SIE on the 3081), the Dutch Electrologica X8 running THE, Norway’s NORD-1, and DEC’s VAX/VMS made virtual memory standard [1].

Translation Overhead in Big-Memory Servers

Paging solved 1960s memory scarcity, yet it creates real slowdowns on today’s multi-gigabyte servers [6, 7]. In a 2013 paper in ACM SIGARCH Computer Architecture News, A. Basu, J. Gandhi, J. Chang, M. D. Hill, and M. M. Swift reported that big-memory workloads—databases, in-memory caches, and graph analytics—can lose up to 10% of execution cycles to translation lookaside buffer (TLB) misses even when using large pages. Those workloads keep most pages read-write, configure servers not to swap, and rarely need page-by-page flexibility [6].

To cut that tax, Basu’s team prototyped direct segments on x86-64 Linux. Each core adds simple base, limit, and offset registers to map one large contiguous virtual region straight onto contiguous RAM—bypassing TLB misses for database buffer pools while leaving normal paging intact elsewhere and letting direct-mapped memory convert back to paging when needed [6]. Three years later in IEEE Micro, J. Gandhi, V. Karakostas, F. Ayar, A. Cristal, M. D. Hill, K. S. McKinley, M. Nemirovsky, M. M. Swift, and O. Ünsal generalized that idea with range translations, mapping arbitrary-sized ranges to contiguous RAM pages with near-zero translation cost [7].

Argument list layout in the Multics execution stack
Inter-procedure argument list structure in Multics segmented memory. (Credit: Multicians.org)

Database engineers have also turned hardware virtual memory into a storage engine tool. In 2023, V. Leis, A. Alhomssi, T. Ziegler, Y. Loeck, and C. Dietrich published Virtual-Memory Assisted Buffer Management in Proceedings of the ACM on Management of Data, introducing vmcache. Instead of maintaining software hash tables or pointer swizzling, vmcache uses hardware virtual memory to map page identifiers to addresses while keeping control over faulting and eviction—unlike standard mmap—and pairs with a Linux extension called exmap to fix OS page-table bottlenecks on fast SSDs [8].

How Memory Virtualization Extends Virtual Memory

While virtual memory abstracts RAM and disk inside a single computer, memory virtualization takes the idea across a data-center network. It decouples volatile RAM from individual servers and pools that memory into one shared resource that any machine in a cluster can reach. That cluster-wide pool can act as a fast cache, a messaging layer, or a shared memory space for CPU and GPU jobs, letting applications tap far more RAM than a single motherboard holds [9]. The broader push to pool and move RAM into data centers reflects those same capacity limits in large compute clusters.

Clusters integrate pooled memory in two main ways. At the application level, programs talk to the pool through an API or a networked file system; at the operating system level, the kernel attaches its page cache to the pool so software sees extra memory without code changes. Unlike single-machine shared memory or flash-based SSDs—which replace hard drives rather than volatile DRAM—memory virtualization complements or replaces local RAM across nodes [9].

Several commercial and open platforms have built on this model. Examples include RNA networks’ Memory Virtualization Platform, ScaleMP for combining machines into one computing image, Wombat Data Fabric for financial market feeds, and distributed Java caches such as Oracle Coherence, Microsoft’s AppFabric Caching Service, IBM Websphere extremeScale, and GigaSpaces XAP alongside VMware GemFire [9]. Meanwhile, single-computer operating systems still differ in how they partition virtual space: most run each task in its own private address space, whereas IBM i—following older OS/VS1 and OS/VS2 SVS designs—runs every process inside one giant shared virtual address space [1].

Sources
  1. WEBSITE Wikipedia. (n.d.). Virtual memory. [Article Link]
  2. WEBSITE Wikipedia. (n.d.). Memory management unit. [Article Link]
  3. DICTIONARY ENTRY Free On-Line Dictionary of Computing. (1999, May 24). Memory management unit. [Article Link]
  4. WEBSITE Bensoussan, A., Clingen, C. T., & Daley, R. C. (2015, November 24). The Multics virtual memory: Concepts and design. Multicians.org. [Article Link]
  5. WEBSITE Multicians.org. (2026, August 2). Execution environment. [Article Link]
  6. ACADEMIC JOURNAL Basu, A., Gandhi, J., Chang, J., Hill, M. D., & Swift, M. M. (2013). Efficient virtual memory for big memory servers. ACM SIGARCH Computer Architecture News, 41(3), 237–248. [Article Link]
  7. ACADEMIC JOURNAL Gandhi, J., Karakostas, V., Ayar, F., Cristal, A., Hill, M. D., McKinley, K. S., Nemirovsky, M., Swift, M. M., & Ünsal, O. (2016). Range translations for fast virtual memory. IEEE Micro, 36(3), 118–126. [Article Link]
  8. ACADEMIC JOURNAL Leis, V., Alhomssi, A., Ziegler, T., Loeck, Y., & Dietrich, C. (2023). Virtual-memory assisted buffer management. Proceedings of the ACM on Management of Data, 1(1), 1–25. [Article Link]
  9. WEBSITE Wikipedia. (n.d.). Memory virtualization. [Article Link]

Cover image: Wikimedia Commons, CC BY-SA 3.0

Leave a Comment

Related Posts
Total
0
Share