Linux kernel Source-code scenario analysis-memory management

Source: Internet
Author: User

There are several pages of user space:

1. Normal User space page, including the process code snippet, data segment, stack segment, and dynamically allocated "storage heap".

2. The contents of the open file mapped to the user space through the system call MMAP ().

3, the shared memory area between processes.

The turnover of these pages has two meanings.

1, the allocation of pages, use, recycling. such as process pressure stack of the newly requested page, this type of page does not make the swap, the release can be recycled when not in use.

This section is explained by a scenario:

Linux kernel source Scenario analysis-Extension of the user stack for memory management.

2, the exchange of the plate area. to execute the corresponding code snippet on the hard disk. Swap the code snippet on the hard disk in memory to execute.

This section is explained by three scenarios:

Linux kernel source scenario analysis-swap in the user page of memory management.

Linux Kernel Source scenario analysis-allocation of user pages for memory management.

Linux kernel source scenario analysis-Periodic swap out of the user page of memory management.


There are several types of kernel space pages:

1. The memory page of the kernel code and the global amount in the kernel does not need to be allocated or released. This part of the space is static.

2, the kernel through kmalloc the latter vmalloc distribution, used for some temporary use and for the management purposes of the data structure, such as vma_area_struct data structure, once the use of these structures is not saved value, so immediately release. However, because a page tends to have multiple data structures in the same way, the page can be released when the entire page is idle.

3, in the kernel by calling Alloc_pages (), for some temporary use and management purposes of the allocation of pages, for example, each process of the core stack of two pages, copy parameters from the kernel space used by the page and so on. These pages are also not saved once they are used, so they are released immediately.

4, there is a page in the kernel, although the use is complete, but its content is still stored value, therefore, not immediately released. This type of page is "released" and enters an LRU queue after a period of buffering to "age". If the content is to be used in the meantime, it will be put into use, otherwise it will continue to age until the condition is no longer allowed. The kernel pages for this purpose are roughly the following: · A file system used to buffer the storage of some file directory structure Dentry · The space used in the file system to buffer the inode of some index nodes · A buffer for file system read/write operations.

Linux kernel Source-code scenario analysis-memory management

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.