Unit V Memory Management 1222022 Basics of Memory

Unit V Memory Management 1/22/2022

Basics of Memory Management § In the multiprogramming environment the user space is divided into Number of Partition. § Each partition is for one process § Task of sub division is carried out dynamically by OS known as “ Memory Management”. § A Few process are in main memory, remaining process are waiting I/O and Processor will be idle. § Memory management provides protection by using two registers: § Base register holds the smallest legal physical memory address § Limit register specifies the size of the range 2 Memory Management 1/22/2022

Basics of Memory Management 3 Memory Management 1/22/2022

Binding of Instructions and Data to Memory � Address binding of instructions and data to memory addresses can happen at three different stages. � Compile time � When it is known at compile time where the process will reside, compile time binding is used to generate the absolute code. � Must recompile code if starting location changes. � Load time: � Must generate relocatable code if memory location is not known at compile time. � Execution time � If the process can be moved during its execution from one memory segment to another, then binding must be delayed to be done at run time 4 Memory Management 1/22/2022

Multistep Processing of a User Program 5 Memory Management 1/22/2022

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 – address generated by the CPU; also referred to as virtual address" § Physical address – Address seen by memory management unit, one loaded into memory address register called Physical Address. § Logical and physical addresses are the same in compile-time and load time address-binding schemes. § logical (virtual) and physical addresses differ in execution-time address-binding scheme 6 Memory Management 1/22/2022

Logical Vs Physical Address Space § The runtime mapping from logical to physical address is done by Hardware device called Memory Management Unit (MMU). § The base Register is also called the relocation Register. § The value of Relocation register is added to every address generated by a user process at the time it is send to memory. § Relocation register is a special register in the CPU used for program relocation means mapping of logical addresses used by the program to physical addresses of the system’s main memory 7 Memory Management 1/22/2022

Dynamic relocation using a relocation register Physical Address Space = Logical address space + Contents of Relocation Register 8 Memory Management 1/22/2022

Swapping § A process can be swapped temporarily • out of memory to a backing store, • brought back into memory for continued execution • Total physical memory space of processes can exceed physical memory § Backing store – fast disk • large enough to accommodate copies of all memory images for all users; • must provide direct access to these memory images 4 § Roll out, roll in – swapping variant § used for priority-based scheduling algorithms; § lower-priority process is swapped out so higher-priority process can be loaded and executed 9 Memory Management 1/22/2022

Schematic View of Swapping 10 Memory Management 1/22/2022

Thank You! Questions ? 11 Memory Management 1/22/2022
- Slides: 11