Linux Memory Management Knowledge

  

Q1. Why divide the process's address space into "kernel space" and "user space"?

A: The size of the virtual address space of Linux is 4GB. The kernel divides the 4GB space into two parts. The higher 1GB (virtual address 0xC0000000 to 0xFFFFFFFF) is used by the kernel, called "kernel space". ”; and the lower 3GB (virtual address 0x00000000 to 0xBFFFFFFF) for each process, called "user space"; because each process can enter the kernel through system calls, so the kernel space is all processes within the system Sharing; thus, from a process perspective, each process can have 4GB of virtual address space (also known as virtual memory).


Q2. How does Linux implement “ request paging?

A:

1) If the page being accessed is not in memory, that is, the page has not been stored in any of the physical pages, then the kernel allocates a new page and Properly initialize it, this technique is called "request paging";

2) & ldquo; request paging is a dynamic memory allocation technology that delays the allocation of pages to After delaying, that is, until the page to be accessed by the process is not in physical memory, causing a page fault exception; the introduction of this technology is mainly because the process does not access all of its address space when it starts running. address.

Copyright © Windows knowledge All Rights Reserved