2.5. Paging in Linux
As we explained in Section 2.4.5, Linux adopted a three-level paging model so paging is feasible on 64-bit architectures. Figure 2-9 shows the model, which defines three types of paging tables:
Page Global Directory
Page Middle Directory
Page Table
The Page Global Directory includes the addresses of several Page Middle Directories, which in turn include the addresses of several Page Tables. Each Page Table entry points to a page frame. The linear address is thus split into four parts. Figure 2-9 does not show the bit numbers because the size of each part depends on the computer architecture.
Figure 2-9. The Linux paging model
Linux handling of processes relies heavily on paging. In fact, the automatic translation of linear addresses into physical ones makes the following design objectives feasible:
Assign a different physical address space to each process, thus ensuring an efficient protection against addressing errors.
Distinguish pages, that is, groups of data, from page frames, that is, physical addresses in main memory. This allows the same page to be stored in a page frame, then saved to disk, and later reloaded in a different page frame. This is the basic ingredient of the virtual memory mechanism (see Chapter 16).
As we shall see in Chapter 7, each process has its own Page Global Directory and its own set of Page Tables. When a process switching occurs ...
Get Understanding the Linux Kernel now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.