The paging policy in the Linux operating system-general Linux technology-Linux programming and kernel information. The following is a detailed description. In Linux, each process has its own page table. That is to say, the Mappings of processes are different from each other, so that the virtual addresses of each process are not mapped to the same physical address. This is because processes must be independent of each other and their data must be isolated to prevent information leakage.
In addition, the kernel, as an independent part that must be protected, has its own independent page table to map kernel space (not all space, but only physical memory size ), this page table (swapper_pg_dir) is statically allocated. It only maps the kernel space (swapper_pg_dir only uses the items after 768 Items-768 page directories can map 3G space ). This independent page table ensures that the kernel virtual space is independent from other user program spaces. That is to say, other processes are normally not associated with the kernel (when compiling the kernel, the kernel code is specified to link to space above 3 GB), so the kernel data is naturally protected.
What can be done when a user process needs to access the kernel space?
Linux uses a clever method: the first 768 Items of the user process page table map the process space (<3G, because LDT only specifies the base address as 0, and the range can only be 0xc0000000 ), if a process needs to access the kernel space, such as calling a system call, the table item after the first item in the page Directory of the Process points to the item after the second item of swapper_pg_dir, so once the user falls into the kernel, we started to use the kernel page table swapper_pg_dir, which means we can access the kernel space.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.