John Rodewald
Personal notes I've decided to make public for some reason.


Page Table

Posted on

The page table maps virtual page numbers to physical page numbers per process. Any data structure could be used for this. The simplest choice is a linear page table: an array with virtual page numbers as indices. While simple, it is also space-inefficient (Multi-level-Page-Tables).

Besides the physical page number that maps to the virtual page number, additional bits are stored in each entry:

NameDescription
Valid bitIs this page currently allocated or unused?
Protection bitsCan this be read from, written to, or both?
Present bitIs this page swapped out to disk?
Dirty bitHas this page been modified since its allocation?
Reference bitHas this page been accessed since its allocation?
Mode bitCan this page be accessed by user-mode processes?

The valid bit in particular helps reduce memory usage: physical page numbers are huge, so we only want to map them to virtual page numbers when memory is actually allocated.

Tags: programming ostep