内核函数get_free_pages, kmalloc, vmalloc比较(转载)
2009-12-29 17:13
465 查看
(1) 請比較與說明幾個 memory management 相關 kernel functions: --get_free_pages(), kmalloc(), vmalloc(), brk(), 其管理機制、使用時機、特性比較。
[Ans]
a. __get_free_pages() :
對象: Contiguous Page frame
Allocate方式: Buddy System Algorithm
b. kmalloc():
對象: Contiguous Memory Area
Allocate方式: Slab Allocator
c. vmalloc() :
對象: Non-Contiguous Memory Area
Allocate方式: Slab Allocator
d. brk() :
對象: Memory Region (User Process Address Space)
作用: Change heap size of the process
[Notes]
(1) 在Linux上, Physical memory 依Size固定與否,分成兩種概念:
Page Frame: Fixed Length (4KB)
Memory Area: Arbitrary Length
相對應這兩種, 各用不同的實體記憶體管理方式(allocate/release)
Buddy System Algorithm --> Page Frame
Slab Allocator --> Memory Area
[Notice]
不管 page frame 或 memory area都是指"contiguous physical address",
只是有分固定或任意長度的差別.
(2) __get_free_page: “ Used to request 2 ordercontiguous page frame “
kmalloc(): “ Used to allocate contiguous general objects .(memory area) “
[Notice]
-因用Buddy System Algorithm,故是2order Size.
-在Slab Allocator把每個memory area視為 Object. 雖然 Memory area 可任意長度,但在Linux Implement 作法是把Object的Size 定為geometrically distributed size (ranging from 32 ~1331072).
(3) kmalloc() 與 vmalloc() 主要差別是, vmalloc()所要到的 Memory area 是非連續的.
即 “ linear address is assigned to noncontiguous memory area ”, 每個 Memory area是連續的
physical address , 但個別 memory area是不相連的.
(4) Memory Region 是指 “ interval of user process address space “, 通常起始位址與長度是4096的倍數, 故 process 的 address space 就由 a set of memory region list來代表在Linear address space上的位置. brk() 這個System Call即是在User Level 向Kernel要求調整Process 的heap Size.
原文地址:http://blog.chinaunix.net/u1/35281/showart_279244.html
[Ans]
_ _ get_free_pages | Page frame management | Kernel | Physical |
kmalloc | Memory area management | Kernel | Physical |
vmalloc | Non-contiguous memory area management | Kernel | Physical/ virtual |
brk | Process address space management | User process | viirtual |
a. __get_free_pages() :
對象: Contiguous Page frame
Allocate方式: Buddy System Algorithm
b. kmalloc():
對象: Contiguous Memory Area
Allocate方式: Slab Allocator
c. vmalloc() :
對象: Non-Contiguous Memory Area
Allocate方式: Slab Allocator
d. brk() :
對象: Memory Region (User Process Address Space)
作用: Change heap size of the process
[Notes]
(1) 在Linux上, Physical memory 依Size固定與否,分成兩種概念:
Page Frame: Fixed Length (4KB)
Memory Area: Arbitrary Length
相對應這兩種, 各用不同的實體記憶體管理方式(allocate/release)
Buddy System Algorithm --> Page Frame
Slab Allocator --> Memory Area
[Notice]
不管 page frame 或 memory area都是指"contiguous physical address",
只是有分固定或任意長度的差別.
(2) __get_free_page: “ Used to request 2 ordercontiguous page frame “
kmalloc(): “ Used to allocate contiguous general objects .(memory area) “
[Notice]
-因用Buddy System Algorithm,故是2order Size.
-在Slab Allocator把每個memory area視為 Object. 雖然 Memory area 可任意長度,但在Linux Implement 作法是把Object的Size 定為geometrically distributed size (ranging from 32 ~1331072).
(3) kmalloc() 與 vmalloc() 主要差別是, vmalloc()所要到的 Memory area 是非連續的.
即 “ linear address is assigned to noncontiguous memory area ”, 每個 Memory area是連續的
physical address , 但個別 memory area是不相連的.
(4) Memory Region 是指 “ interval of user process address space “, 通常起始位址與長度是4096的倍數, 故 process 的 address space 就由 a set of memory region list來代表在Linear address space上的位置. brk() 這個System Call即是在User Level 向Kernel要求調整Process 的heap Size.
原文地址:http://blog.chinaunix.net/u1/35281/showart_279244.html
相关文章推荐
- 转一篇文章,比较kmalloc/vmalloc/get_free_pages
- 比较kmalloc/vmalloc/get_free_pages
- 内核中的内存申请:kmalloc、vmalloc、kzalloc、kcalloc、get_free_pages
- kmalloc、vmalloc、__get_free_pages()的区别
- 内核中的内存申请:kmalloc、vmalloc、kzalloc、kcalloc、get_free_pages【转】
- 内核中的内存申请:kmalloc、vmalloc、kzalloc、get_free_pages 之间的区别
- kmalloc函数及相关的malloc、vmalloc、get_free_pages
- 内存分配方法 kmalloc()、vmalloc()、__get_free_pages()
- [转载]kmalloc vmalloc kcalloc kzalloc malloc 和 get_free_page()
- 转:内核中的内存申请:kmalloc、vmalloc、kzalloc、kcalloc、get_free_pages
- linux 内存管理之kmalloc、vmalloc、malloc、get_gree_pages的区别
- kmalloc kzalloc vmalloc malloc 和get_free_page()的区别
- linux内核__get_free_page,kmalloc,vmalloc的区别,内核对内存的管理
- kmalloc vmalloc kzalloc malloc 和 get_free_page()
- kmalloc()和__get_free_pages()
- kmalloc vmalloc kzalloc malloc 和 get_free_page()
- kmalloc、get_free_page、vmalloc的区别(根据自己的理解总结了一下)
- kmalloc()和__get_free_pages()
- linux 共享内存映射原理 vmalloc kmalloc getfreepage
- kmalloc vmalloc kzalloc malloc 和 get_free_page()