Paging Idea • Break the program’s address space into equal sized pages • Break the main memory into equal sized frames • Page size=frame size=2^k words where k is a positive integer Effective address • View the effective address is page number and offset within that page • Splitting this way is easy: the last k bits will form the offset and the other bits will form the page number Address translation • Maintain a page map table (one per process) • For each address, find the page number p • Use p as an index and find the corresponding frame number f • Concatenate f and offset. Fragmentation • There is no external fragmentation • There is internal fragmentation: The last page of a process may not be fully utilized and the part that is not fully used is wasted Storing the page map table • In registers – expensive and fast • In memory – slow and inexpensive • Hybrid scheme (use cache) – some rows of the table are in registers – rest are in main memory – if DAT can be done using register contents, you have a hit and well and good; otherwise, Choice of page size • Too small? – Too many pages for a process; page map table is too large • Too large? – Waste memory due to internal fragmentation • How to decide: Choice of page size • Let g be page size; s be size of average process; m be size of one row of page map table • memory wasted (internal frag+page map table) =g/2+s*m/g • minimize this (g = sqrt(2*s*m))