Home  >  Article  >  Operation and Maintenance  >  What is the principle of Linux kernel page table and page table cache?

What is the principle of Linux kernel page table and page table cache?

WBOY
WBOYforward
2023-05-14 14:52:061555browse

1. Related concepts

[Page]: Blocks in the process.
[Page frame]: block in memory.
[Page table]: A special data structure that stores the page table area of ​​the system space (storing the correspondence between logical pages and physical page frames). Each process has its own page table, and there are pointers in the PCB table pointing to the page table.

2. Page table entry

(1) Logical address (page number, offset), the logical address is the virtual address. For example, the page table entries of the secondary page table are as follows:

What is the principle of Linux kernel page table and page table cache?

(2) Physical address (page frame number, offset). The mapping relationship is as follows:

What is the principle of Linux kernel page table and page table cache?

3. Page table cache

[Page table cache]: CPU memory management unit (MMU), processor manufacturer in memory A cache (called the page table cache) added to the snap-in. Function to convert virtual addresses into physical addresses.

What is the principle of Linux kernel page table and page table cache?

4. Their relationship

  1. The page table is composed of multiple page table entries, and each row in the page table is a page table entry.

  2. Page frame number: specially used to store the physical page corresponding to the virtual page.

  3. Page table entries are designed by hardware.

  4. Page directory provides a directory (two-dimensional structure) for the page table and supports multi-level search. When an application is running on the CPU, it needs to put the starting address of the page directory into a register (because the virtual address translation process requires an offset).

  5. The working process of MMU: CPU obtains the virtual address–>MMU queries the page directory–>MMU queries the page table–>MMU obtains the page table entry–> MMU obtains the physical page number–>MMU obtains the physical address.

The above is the detailed content of What is the principle of Linux kernel page table and page table cache?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete