A Tool for Memory Management 0 Virtual 0 Address Translation Physical Address Address VP 1 PP 2 Space for Space VP 2 Process 1 (DRAM) (e. g, readonly PP7 library code) Virtua Address VP 1 Space for VP 2 PP 10 Process 2 N-1
11 A Tool for Memory Management Virtual Address Space for Process 1: Physical Address Space (DRAM) VP 1 VP 2 PP 2 0 Address Translation 0 N-1 0 N-1 M-1 VP 1 VP 2 PP 7 PP 10 (e.g., read/only library code) ... ... Virtual Address Space for Process 2:
A Tool for Memory Management memory invisible kernel virtual memory user code %esp stack Linux/x86 Memory mapped region fors hared libraries process memory the“ brk"ptr Image runtime heap via malloc) uninitialized data(bss) initialized data data) program text ( text) forbidden 12 Figure 10.10 P702
12 A Tool for Memory Management kernel virtual memory Memory mapped region forshared libraries runtime heap (via malloc) program text (.text) initialized data (.data) uninitialized data (.bss) stack forbidden %esp memory invisible to user code the “brk” ptr Linux/x86 process memory image Figure 10.10 P702
10.5 VM as a Tool for Memory Protection
13 10.5 VM as a Tool for Memory Protection
A Tool for Memory Protection Page table entry contains access rights information hardware enforces this protection(trap into OS if violation occurs)
14 A Tool for Memory Protection • Page table entry contains access rights information – hardware enforces this protection (trap into OS if violation occurs)
A Tool for Memory Protection Page Tables Memory Read? Write? Physical Addr 0 VP 0: Yes N PP 9 Process I:VP 1: Yes Yes PP 4 VP 2: No No XXXXXXX Read? Write? Physical Addr VP 0: Yes Yes PP 6 Process j: VP 1:Yes No PP 9 VP 2: No No XXXXXXX 15
15 A Tool for Memory Protection Page Tables Process i: Read? Write? Physical Addr Yes No PP 9 Yes Yes PP 4 No No XXXXXXX VP 0: VP 1: VP 2: • • • • • • • • • Process j: 0: 1: N-1: Memory Read? Write? Physical Addr Yes Yes PP 6 Yes No PP 9 No No XXXXXXX • • • • • • • • • VP 0: VP 1: VP 2: