2 0 PUSH ax 1 MOV bx 1
2、地址变换机构 实现逻辑地址(相对地址)到物理地址的变换 相对地址 分页 0 PUSH ax 1 MOV bx, 1 POP bx 2 3 4 5 6 JMP [1] 分块块号 120 0 30 1 2 1000 程序 操作系统 JMP[401] [1] 121 122 123 100 7 8 9 物理地址 6/54 . . . PUSH ax 400 MOV bx, 1 401 POP bx 402 403. . . 4001 4002 Lifang 2011
分页系统的地址变换 Virtual Address Page # Offset Frame # Offset Register Page Table Ptr Page Table Offset + P# Frame # Program Paging 操作系统 9/54 Main Memory Lifang 2011 Page Frame
转换过程: 每页大小 1 K: 0100 0000 0 A 5 C: 0000 1010 0101 1100 1000 0000 0010 0101 1100 因此:物理地址=4 K+25 C 4 K: 0001 0000 25 C: 0000 0010 0101 1100 物理地址 : 0001 0010 0101 1100 0000 1001 0011 1100 1000 0000 0001 0011 1100 因此:物理地址=4 K+13 C 4 K: 0001 0000 13 C: 0000 0001 0011 1100 物理地址 : 0001 0011 1100 页号 块号 0 5 1 10 2 4 3 7 =2 K : 物理块号=4 =25 C : 偏移 即: 125 C 093 C: 操作系统 15/54 =2 K : 物理块号=4 =13 C : 偏移 即: 113 C Lifang 2011
举例: 例1: 页面大小是 1 KB,虚地址是 3 BADH 0 0 1 1 1 0 1 15 14 10 1 9 P=0 EH 0 W=3 ADH 例2: 页面大小是 2 KB,虚地址是 3 BADH 0 0 1 1 1 0 1 15 14 10 P=07 H 操作系统 1 9 0 W=3 ADH 17/54 Lifang 2011
Effective Access Time Associative Lookup = time unit Assume memory cycle time is 1 microsecond(微秒) Hit ratio:percentage of times that a page number is found in the associative registers; ration related to number of associative registers Hit ratio = Effective Access Time (EAT) EAT = (1 + ) + (2 + )(1 - )= 2 + - 操作系统 26/54 Lifang 2011
Memory Protection ØMemory protection implemented by associating protection bit with each frame ØValid-invalid bit attached to each entry in the page table: • valid indicates that the associated page is in the process logical address space, and is thus a legal page • invalid indicates that the page is not in the process logical address space 操作系统 30/54 Lifang 2011
Memory Protection 14 -bit逻辑地址空间 (可分为 8页) Page size: 2 K 当前某个进程只访问 到 10468(页号为 5) 操作系统 31/54 Lifang 2011
Address-Translation Scheme for a two-level 32 -bit paging architecture 操作系统 34/54 Lifang 2011
Inverted Page Table 操作系统 36/54 Lifang 2011
Example of Segmentation 操作系统 43/54 Lifang 2011
分段保护 Protection. With each entry in segment table associate: validation bit = 0 illegal segment read/write/execute privileges 操作系统 44/54 Lifang 2011
页式管理与段式管理的比较: Page 0 Application Code Segment 0 L 1 2 Data 1 3 4 0 0 M Free Space 5 6 7 Stack 2 0 N
Shared Pages Example 操作系统 48/54 Lifang 2011
- Slides: 54