The Linux Virtual Memory System: The Linux Address Space

Get an overview of​ the Linux​ address space and the two types of kernel addresses present in Linux.

We’ll now discuss some of the more interesting aspects of the Linux VM system. Linux development has been driven forward by real engineers solving real problems encountered in production, and thus a large number of features have slowly been incorporated into what is now a fully functional, feature-filled virtual memory system.

While we won’t be able to discuss every aspect of Linux VM, we’ll touch on the most important ones, especially where it has gone beyond what is found in classic VM systems such as VAX/VMS. We’ll also try to highlight commonalities between Linux and older systems.

For this discussion, we’ll focus on Linux for Intel x86. While Linux can and does run on many different processor architectures, Linux on x86 is its most dominant and important deployment, and thus the focus of our attention.

Overview

Much like other modern operating systems, and also like VAX/VMS, a Linux virtual address spaceUntil recent changes, due to security threats, that is. Read the subsections below about Linux security for details on this modification. consists of a user portion (where user program code, stack, heap, and other parts reside) and a kernel portion (where kernel code, stacks, heap, and other parts reside). Like those other systems, upon a context switch, the user portion of the currently-running address space changes; the kernel portion is the same across processes. Like those other systems, a program running in user mode cannot access kernel virtual pages; only by trapping into the kernel and transitioning to privileged mode can such memory be accessed.

In classic 32-bit Linux (i.e., Linux with a 32-bit virtual address space), the split between user and kernel portions of the address space takes place at address 0xC0000000, or three-quarters of the way through the address space. Thus, virtual addresses 0 through 0xBFFFFFFF are user virtual addresses; the remaining virtual addresses (0xC0000000 through 0xFFFFFFFF) are in the kernel’s virtual address space. 64-bit Linux has a similar split but at slightly different points. The figure below shows a depiction of a typical (simplified) address space.

Get hands-on with 1200+ tech skills courses.