Linux Kernel Architecture

(Jacob Rumans) #1

Virtual Process Memory


The virtual address space of userland processes is an important abstraction of Linux: It allows the
same view of the system to each running process, and this makes it possible for multiple processes
to run simultaneously without interfering with the memory contents of the others. Additionally, it
allows various advanced programming techniques like memory mappings. In this chapter, I will
discuss how these concepts are realized in the kernel. This also requires an examination of the
connection between page frames of the available physical RAM and pages in all virtual process
address spaces: Thereverse mappingtechnique helps to track which virtual pages are backed by
which physical page, andpage fault handlingallows filling the virtual address space with data from
block devices on demand.

4.1 Introduction


All the memory management methods discussed in the preceding chapter were concerned either
with the organization of physical memory or management of the virtual kernel address space. This
section examines the methods required by the kernel to manage the virtualuseraddress space. For
a variety of reasons, some of which are given below, this is more complex than managing kernel

Address Spaces


❑ Each application has its own address space that is segregated from all other applications.

❑ Usually only a few sections of the large linear address space available to each userspace
process are actually used, and they may also be some distance from each other. The kernel
needs data structures to efficiently manage these (randomly) spread sections.

❑ Only the smallest part of the address space is directly associated with physical pages. Infre-
quently used parts are linked with pages only when necessary.

❑ The kernel has trust in itself, but not in user processes. For this reason, each operation to
manipulate user address space is accompanied by various checks to ensure that programs
cannot acquire more rights than are due to them and thus endanger system stability and
security.
Free download pdf