Multi-Level Page Tables Level 2 Virtual Page Table Page T ables Memory VP O PTE O I O vF1023 PTE 2Ka晶 ocated VM pages vF1024 for code and data PTE2(null) PTE 1023 PTE 3(null) vP2047 PTE 4(null) 匚PTE0 PTE 5(null) PTE 6(null) PTE 1023 PTE 7(null) gap 6K unallocated VM pages PTE 8 1023nu (1K-9) PTES null PTEs PTE 1023 unallocated 1023 unaLlocated pages aaes vP9215 1 lOcated vM page Figure 10. 18 P710 for the stack
6 Multi-Level Page Tables Figure 10.18 P710
Multi-Level Page Tables VIRTUAL ADDRESS n-1 P VPN 1 VPN 2 VPN K VPO Level 1 Level 2 Level k Page Table Page Table Page Table PPN PPO PHYSICAL ADDRESS Figure 10. 19 P711
7 Multi-Level Page Tables Figure 10.19 P711
Representation of virtual Address Space P=1.M=1 Page 15 PT3|P=0,M=0 Page 14 P=1.M=1 P=0.M=1 Page 13 Page Directory Page 12 P=1,M=1 P=1,M=1 Pt P=0,M=0 Page 11 P=1,M=1 P=1.M=1 P=0.M=0 P=0.M=1 P=0,M=1 P=0.M=1 PTO Page 8 P=0.M=1 Page 7 P=0.M=0 P=0,M=0 Page 6 Simplified Example Page 4 Mem Addr 16 page virtual address space age 3 e Disk addr Flags In mem P: Is entry in physical memory? Page 1 On Disk M: Has this part of va space been Page o mapped? Unmapped
8 • Simplified Example – 16 page virtual address space • Flags – P: Is entry in physical memory? – M: Has this part of VA space been mapped? Page Directory PT 3 P=1, M=1 P=1, M=1 P=0, M=0 P=0, M=1 • • • • P=1, M=1 P=0, M=0 P=1, M=1 P=0, M=1 • • • • P=1, M=1 P=0, M=0 P=1, M=1 P=0, M=1 • • • • P=0, M=1 P=0, M=1 P=0, M=0 P=0, M=0 • • • • PT 2 PT 0 Page 0 Page 1 Page 2 Page 3 Page 4 Page 5 Page 6 Page 7 Page 8 Page 9 Page 10 Page 11 Page 12 Page 13 Page 14 Page 15 Mem Addr Disk Addr In Mem On Disk Unmapped Representation of Virtual Address Space
10.4 VM as a Tool for Memory Management
9 10.4 VM as a Tool for Memory Management
A Tool for Memory Management Separate virtual address space Each process has its own virtual address space Simplify linking sharing loading, and memory allocation
10 A Tool for Memory Management • Separate virtual address space – Each process has its own virtual address space • Simplify linking, sharing, loading, and memory allocation