随笔 - 53, 文章 - 0, 评论 - 3, 引用 - 0
数据加载中……

High level summary of my understanding on Linux Kernel Memory Management

Here is just the high level summary of my understanding on Linux Kernel Memory Management. I think it can help achieve a better understanding of the book <<understanding linux kernel>>.

It is said, the memory management is most complex sub-system in linux kernel, at the same time, there aren't too much System Calls for it. Becuase most the the complex mechanism happens trasparently to the user process, such as COW(Copy On Write), On Demand Paging. For user process, to successfully refer to a linear memory address, the following factors are necessary:
    vm_area_struct (Virtual Memory Area, Memory Region) are set up correctly.
    Phsical memory are allocated.
    Page Global Directory, Page Table, and the corresponding entry are correclty set up according to Virtual Memory Area and Phisical Meory.
   
This three factors can be further simplified as
    Virtual Memory
    Phisical Memory
    Mappting between Virtual Momory and Phisical Memory.

From user process's perspective, only Virtual Memory is visible, when user process applys for memory, he got virtual memory; phisical memory may not be allocated yet. All these three factors are managed by the kernel, they can be thought of as three resource managed by the kernel. kernel not only need to manage the Virtual Memoty in user address space, but also need to manage Virtual Memory in kernel address space.

When user process try to use his virtual memory, but the phisical memory is not allocated yet. Page Exception happens, kernel take charge of it and allocate the phisical memory and set up the mapping. user process reexecute the instruction and everything go forward smoothly. It's called On Demand Paging.

Besides that there are many more concepts, such as Memory mapping, non-linear memory mapping. I will continue this article when I dig into the details.

posted on 2008-07-29 12:20 InPractice 阅读(267) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航: