OS Memory Management
OS Memory management is basically the core functionality of an operating system which manages the primary memory. Memory management retains pathway of each and every memory location also it is allocated to some process or it is free. It also checks how much memory space is to be allocated to processes. Which process should get the memory is decided by memory management. Limit and base registers are used for memory management protection. The base register is used to holds the small legal physical memory address and limit register identify the size of the rang. Let’s take an example, if the base register holds 300000 and the
limit register is 1209000, then the program can officially access all addresses from 300000 through 411999.
Data and instruction to memory addresses may be done in following techniques
- Compile time
- Load time
- Execution time
Whenever it is identified at compile time where the process will reside, compile time binding is used to generate the entire code.
When it is unknown at compile time where the process will exist in memory, then the compiler produces re-locatable.
In case if the process can be moved in its execution from one memory segment to another, then binding must be overdue to be done at run time
Program does not load its routine until it is called by the program. All routines are preserved on disk in a re-locatable load format. The Main Program execute when it is loaded into the memory. Other routines modules or methods are loaded on request. Dynamic loading makes better memory utilization and it never loads unused routines.
Linking is the procedure of collecting and linking various modules of code and data into a executable file that can be loaded into memory and executed. system level libraries can be linked to a program by operating system. When libraries are combined at load time, the linking is called static linking and whenever this linking is done at the time of execution, it is called as dynamic linking.
Logical versus Physical Address Space
An address which is generated by the CPU is a logical address while address actually existing on memory unit is a physical address. Logical address is also named a Virtual address. Virtual and physical addresses are the same in load-time and compile-time address-binding schemes. Virtual and physical addresses vary in execution-time address-binding scheme. The set of all logical addresses generated by a program is stated as a logical address space. The set of all physical addresses corresponding to these logical addresses is stated as a physical address space. The run-time plotting from virtual to physical address is done by the memory management unit (MMU) which is a hardware device.