In linux, the regular paging mode in linux, 32-bit linear addresses are mainly divided into three parts: the top 10 page directory, the middle 10-bit page table, and the low 12-bit offset. Linear address conversion goes through the page Directory table and page table. The purpose of using second-level Paging for regular paging is to reduce the number of RAM required for each process.
Allocate page table requests only for the virtual storage zone required by the process. The Virtual Memory zone is involved here. The description of the process space mainly has two data structures:
Mm_struct describes the entire user space of the process and vm_area_struct describes the intervals (virtual storage areas) in the space. Why does a process have multiple virtual storage zones? The source of each process's virtual memory zone is different, some from executable ing, and some from dynamically allocated memory. Different virtual storage zones have different management permissions. Www.2cto.com returns to the topic. If a level-1 page table is used, 20 table items of 2 are used. 4 MB space is required to represent the page table of a process. If multiple processes are paged, a large amount of RAM is required, and some of these addresses are not used, but RAM is also wasted. Therefore, there is no need to allocate a page table for each process immediately, and the page Directory must be allocated. Only when a process actually needs a page table will it be allocated to improve RAM usage efficiency. The following are the steps to perform paging: 1. the physical address of the page Directory is stored in the control register C3. 2. The fields in the page Directory determine the directory items in the page Directory, And the directory items point to the page table. 3. The fields in the page table determine the page table items in the page table. The page table items contain the physical address of the page box where the page is located.
4. offset determines the relative position in the page. For different architectures, there are three levels of pages and four levels of pages. The main principle is similar.