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 virtual user address space. For a variety of reasons, some of which are given below, this is more complex than managing kernel address space:

□ 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. Infrequently 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.

□ The fork-exec model used under Unix to generate new processes (described in Chapter 2) is not very powerful if implemented carelessly. The kernel must therefore concentrate on managing user address spaces as efficiently as possible by resorting to a few tricks.

Most of the ideas discussed below are based on the assumption that the system has a memory management unit (or MMU) that supports the use of virtual memory. This is, in fact, the situation on all "normal" processors. However, during the development of Linux 2.5, three architectures that do not provide an MMU were added to the kernel sources — V850E, H8300, and m68knommu. Another one (blackfin) was added during the development of kernel 2.6.22. Some of the functions examined below are not available on these CPUs, and the interface to the outside returns error messages because the underlying mechanisms are not implemented in the kernel and cannot be implemented owing to the lack of processor support. The information below covers only machines with MMU. I do not deal with the oddities and modifications needed for MMU-less architectures.

Continue reading here: Virtual Process Address Space

Was this article helpful?

0 0