tailieunhanh - Lecture Operating system concepts (Sixth ed) - Chapter 9: Memory management

In this chapter, we discuss various ways to manage memory. The memory- management algorithms vary from a primitive bare-machine approach to paging and segmentation strategies. Each approach has its own advantages and disadvantages. Selection of a memory-management method for a specific system depends on many factors, especially on the hardware design of the system. As we shall see, many algorithms require hardware support, leading many systems to have closely integrated hardware and operating-system memory management. | Chapter 9 Memory Management Background Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging Operating System Concepts Silberschatz Galvin and Gagne 2002 Background Program must be brought into memory and placed within a process for it to be run. Input queue - collection of processes on the disk that are waiting to be brought into memory to run the program. User programs go through several steps before being run. Operating System Concepts Silberschatz Galvin and Gagne 2002 ._- Binding of Instructions and Data to Memory Address binding of instructions and data to memory addresses can happen at three different stages. Compile time If memory location known a priori absolute code can be generated must recompile code if starting location changes. Load time Must generate relocatable code if memory location is not known at compile time. Execution time Binding delayed until run time if the process can be moved during its execution from one memory segment to another. Need hardware support for address maps . base and limit registers . Operating System Concepts Silberschatz Galvin and Gagne 2002 Multistep Processing of a User Program Operating System Concepts Silberschatz Galvin and Gagne 2002 Logical vs. Physical Address Space The concept of a logical address space that is bound to a separate physical address space is central to proper memory management. Logical address - generated by the CPU also referred to as virtual address. Physical address - address seen by the memory unit. Logical and physical addresses are the same in compiletime and load-time address-binding schemes logical virtual and physical addresses differ in execution-time address-binding scheme. Operating System Concepts Silberschatz Galvin and Gagne 2002 Memory-Management Unit mmu Hardware device that maps virtual to physical address. In MMU scheme the value in the relocation register is added to every address generated by a user process at the time it is sent to