Article Title: linux memory management-Segmented paging Mechanism. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Memory Management-segmented Mechanism
1. some basic concepts: Logical Address, linear address, physical address, real address mode, protection mode, segment register, Segment Base Address Register, segment selection sub-register, segment descriptor, global description table GDT: local description table LDT, GDTR, LDTR, CPL, RPL, DPL, standard for permission check (max (CPL, RPL) <= DPL ).
2. There is a Global Descriptor Table declaration in head. s, including the kernel code segment, kernel data segment, user code segment, and the address of each user data segment. cpu_gdt_table is the base table address.
3. two steps to activate the segmentation mechanism: one is to set the Global Descriptor Table GDT, that is, through head. in s, a program assigns the kernel code segment, kernel data segment, user code segment, and user data segment address to a specific register. Second, enable the protection mechanism, that is, set the protection mode flag bit in the processor control register cr0.
Paging mechanism for memory management:
1. Basic Concepts: page frame, page, page table, and base address register of the page Directory
2. What is the conversion process from a linear address to a physical address based on a second-level page table?
3. What is the structure of the page table item?
4. Why is the second-level page table less space than the first-level page table?
Explanation:
You need to know that each process corresponds to a page table.
For example, for 4g space, 4 K per page
If the ing is a level-1 page table, 2 ^ 20 = 1 m page table items are required (no matter whether it is used or not, the system does not know which address will be accessed)
1 M * 4 = 4 M
Each process requires a 4 m page table.
For two-level page table ing, only one page Directory and one page table item are required (for example, if the process only uses 4 MB of memory). One page Directory occupies 4 K, A page table entry occupies 4 bytes, but a page is displayed. Each process occupies 8 K in total.