Chapter 3 Memory Management
Chapter 3 Memory Management
Content Why need memory management ☆ Memory partitioning 令 Paging ☆ Segmentation MEMORY MANAGEMENT
MEMORY MANAGEMENT Content ❖Why need memory management ❖Memory partitioning ❖Paging ❖Segmentation
3.1 Memory Management Requirements(p289) Relocation(重定位) A Memory protection(保护) 如 Memory sharing(共享 a Logical organization(逻辑组织) A Physical Organization(物理组织) MEMORY MANAGEMENT
MEMORY MANAGEMENT 3.1 Memory Management Requirements (p289) ♣ Relocation(重定位) ♣ Memory Protection(保护) ♣ Memory Sharing(共享) ♣ Logical Organization(逻辑组织) ♣ Physical Organization(物理组织)
Relocation(重定位p290) The processor and os translate the memory references found in the code of the program into actual physical memory addresses, which reflecting the current location of the program in main memory(程序代码中地址引用翻译为主存中当前 地址的过程) MEMORY MANAGEMENT
MEMORY MANAGEMENT Relocation (重定位p290) • The processor and OS translate the memory references found in the code of the program into actual physical memory addresses, which reflecting the current location of the program in main memory.(程序代码中地址引用翻译为主存中当前 地址的过程)
Relocation(p290) Static relocation(静态,一次性重定位 Relocate when compile program or load in program Dynamic relocation(动态,可多次重定位 Relocate when running program. Contents for relocation(定位内容) Branch instruction(分支指令) Reference to data(数据引用) MEMORY MANAGEMENT
MEMORY MANAGEMENT Relocation (p290) • Static relocation(静态,一次性重定位) • Relocate when compile program or load in program. • Dynamic relocation(动态,可多次重定位) • Relocate when running program. • Contents for relocation(定位内容) • Branch instruction(分支指令) • Reference to data (数据引用)
Process control information Process Control Bbc Entry point to program Branch Program instruction Increas ing address values Reference to data Data Current top of stack Stack Figure 7.1 Addressing Requirements for a Process
MEMORY MANAGEMENT
Memory Protection(p291) Each process should be protected against unwanted interference(访问) by other processes. All memory references generated by a process must be checked(检查) at run time The memory protection requirement is satisfied(C]) by the processor (hardware) rather than the os (software) MEMORY MANAGEMENT
MEMORY MANAGEMENT Memory Protection (p291) • Each process should be protected against unwanted interference(访问)by other processes. • All memory references generated by a process must be checked(检查) at run time. • The memory protection requirement is satisfied(完成) by the processor (hardware) rather than the OS (software)
Memory Sharing(共享p291) Share data and code for save(节省) the memory The memory-management system must allow controlled access to shared areas of memory without compromising(影响) essential protection MEMORY MANAGEMENT
MEMORY MANAGEMENT Memory Sharing(共享p291) • Share data and code for save(节省) the memory. • The memory-management system must allow controlled access to shared areas of memory without compromising(影响) essential protection
Logical Organization(p291) OS should deal with programs in the form of modules(模块) Modules can be written and compiled independently. Different degrees of protection can be given to different modules It is easy to implement share. E. g segmentation(分段管理) MEMORY MANAGEMENT
MEMORY MANAGEMENT Logical Organization(p291) • OS should deal with programs in the form of modules(模块) • Modules can be written and compiled independently. • Different degrees of protection can be given to different modules. • It is easy to implement share. • E.g. segmentation(分段管理)
Physical Organization(p292) · Computer memory is organized(组织) into at least two levels, referred to as main memory and secondary memory. Swapping the modules in and out as needed The programmer does not know how much space will be available or where that space will be MEMORY MANAGEMENT
MEMORY MANAGEMENT Physical Organization(p292) • Computer memory is organized(组织) into at least two levels, referred to as main memory and secondary memory. • Swapping the modules in and out as needed. • The programmer does not know how much space will be available or where that space will be