openskills.info
Course Preview

Virtual Memory

Virtual memory gives each process a private address space and maps its addresses to physical memory or other backing storage. The operating system and processor cooperate to provide isolation, controlled sharing, and demand-loaded pages.

itOperating systems

Virtual memory is the system that separates the addresses used by a program from the physical locations that hold its code and data. Each process works inside a private virtual address space. The processor's memory management unit, or MMU, translates each virtual address through page tables maintained by the operating system.

This indirection solves several problems at once. A process can use a continuous range of addresses even when its physical page frames are scattered. Separate page tables isolate processes from one another. Permissions can make a region readable, writable, executable, or inaccessible. Multiple processes can also map the same file or shared-memory object without giving up their private address spaces.

Virtual memory does not mean “RAM plus disk.” Swap is one possible backing store for anonymous pages, but address translation, isolation, permissions, file mappings, and demand allocation still matter on a system with no swap device.

The translation path

Memory is managed in fixed-size units called pages. Physical memory is divided into page frames. A virtual address contains a virtual page number and an offset within that page. The offset survives translation; the virtual page number selects a page-table entry that identifies a physical page frame and carries status and permission bits.

Page tables are hierarchical because a flat table for a large address space would consume memory for ranges that a process never uses. The upper address bits select an entry at the first level, the next bits select the next level, and so on. A leaf entry names the physical frame. Some architectures also let a higher-level entry map a large page, which shortens the walk and covers more memory with one translation.

Continue the course

This section is part of the paid course.

See pricing to subscribe, or log in if you already have access.

Where this skill leads

Relevant careers

See how this topic contributes to broader role-level skill maps.

Sources