IA32 Memory Management

下面這段資料來自於 「Intel® 64 and IA-32 Architectures Software Developer’s Manual」

The memory management facilities of the IA-32 architecture are divided into two parts: segmentation and paging. Segmentation provides a mechanism of isolating individual code, data, and stack modules so that multiple programs (or tasks) can run on the same processor without interfering with one another. Paging provides a mechanism for implementing a conventional demand-paged, virtual-memory system where sections of a program’s execution environment are mapped into physical memory as needed. Paging can also be used to provide isolation between multiple tasks. When operating in protected mode, some form of segmentation must be used. There is no mode bit to disable segmentation. The use of paging, however, is
optional.

IA32 Segmentation 和 Paging 關係圖





簡單來說,Segmentation 是處理器上的機制,每一個正在處理器上運作的 task (應該用「任務」呢?還是用「程式」好呢)都會有他自己獨立的 Segment。而所謂的 Logical Address 指的就是處理器上 Segment 的位址。這個機制最大的好處在於保護每個 task 的記憶體區塊不會互相干擾。

在 linux 裡面常出現的「Segmentation Fault」,指的就是該 task 存取到不屬於該 Segment 的記憶體區塊。

至於 Linear Address 則是指 virtual memory,而 paging 則是用來對應虛擬記憶體和實體記憶體的機制。

留言

這個網誌中的熱門文章

如何將Linux打造成OpenFlow Switch:Openvswitch

如何利用 Wireshark 來監聽 IEEE 802.11 的管理封包

我弟家的新居感恩禮拜分享:善頌善禱