Paging Each process has its own page table Each page table entry contains the frame number of the corresponding page in main memory Two extra bits are needed to indicate P(resent whether the page is in main memory or not M(odified): whether the contents of the page has been altered since it was last loaded
11 Paging • Each process has its own page table • Each page table entry contains the frame number of the corresponding page in main memory • Two extra bits are needed to indicate: – P(resent): whether the page is in main memory or not – M(odified): whether the contents of the page has been altered since it was last loaded
Paging Table Virtual Address Page Number Offset Page Table Entry A MOther Control Bits F rame N umber It is not necessary to write an unmodified page out when it comes to time to replace the page in the frame that it currently occupies 12
12 Paging Table • It is not necessary to write an unmodified page out when it comes to time to replace the page in the frame that it currently occupies
Address Translation The frame no is combined with the Virtual address Physical Address offset to produce Page Offset Frame Offset the real address Register Page Table Pt Page table ambits Offs P Frame The page no is used to index the page table and look up the frame no Program Paging Mechanism Main Memory Figure 8.3 Address Translation in a Paging System 13
13 Address Translation The page no. is used to index the page table and look up the frame no. The frame no. is combined with the offset to produce the real address
Page Tables Page tables can be very large Consider a system that supports 231=2 Gbytes virtual memory with 29=512-byte pages. The number of entries in a page table can be as many as 222 Most virtual memory schemes store page tables in virtual memory Page tables are subject to paging
14 Page Tables • Page tables can be very large – Consider a system that supports 231=2Gbytes virtual memory with 29=512-byte pages. The number of entries in a page table can be as many as 222 • Most virtual memory schemes store page tables in virtual memory • Page tables are subject to paging
TWo-Level Hierarchical Page Table 4-kbvte root Composed of 210 4- page table byte page table entries Composed of 2204- byte page table 4-Mbvte user entries, occupying page table 20 pages 4-Gbvte user address space is composed of 204 kbyte(212) pages Figure 8.4 A Two-Level Hierarchical Page Table 15
15 Two-Level Hierarchical Page Table is composed of 2 20 4-kbyte (212) pages Composed of 220 4- byte page table entries, occupying 2 10 pages Composed of 210 4- byte page table entries