Paging

Operation System

Paging is a very important for memory management. It can help to implement virtual memory and shared memory.

After enabling Paging, by using “segment selector + segment offset” addressing methods, we can get a final 32-bit address. At this time, this address is not physical address. By dividing the into 3 parts, $10+10+12$, we can find the physical address. The first 10 bits are used to find the page table in the page directory, the middle 10 bits are used to find the right page in the page table and the last 12 bits are the offset in the page. So a page has $2^{12}=4$KB. Every prosess has its own page content and pages. However, in some special cases, different processes may share same pages. The address of the directory is stored in register CR3.

The advantage of using Paging is while we are running out of memory, we can write some pages into disk. And this contributes to the implementation of virtual memory.

Post Directory

Directory