簡單說說linux內存

問題1:linux對進程地址空間的3G/1G劃分會致使什麼問題?linux

A:因爲kernel只分配到了1G的地址空間,因此,若是user space的進程沒有給kernel space有效數據的話,它能夠直接尋址的物理內存最多隻有1G。那麼,若是物理內存有2G,就有1G是kernel沒法直接尋址的。app

爲了解決這個問題,開發者引入了low memory 和high memory的概念。low memory也叫main memory,是指內核能直接尋址訪問的那部份內存,在3G/1G的劃分下,實際上會小於1G。high memory是指kernel沒有可以這直接映射的那部份內存。當kernel要使用high memory時,它會創建一個特殊的page table 來映射這部份內存,這個代價是比較昂貴的。spa

For the most part, the kernel's own data structures must live in low memory. Memory which is not permanently mapped cannot appear in linked lists (because its virtual address is transient and variable), and the performance costs of mapping and unmapping kernel memory are too high. High memory is useful for process pages and some kernel tasks (I/O buffers, for example), but the core of the kernel stays in low memory. .net

(以上這段話引自http://lwn.net/Articles/75174/orm

2. 爲何會出現virtual memory?接口

A:簡化內存處理,提供統一接口,更有效的利用物理內存。進程

over內存

相關文章
相關標籤/搜索