memory management Flashcards
Memory management
is the functionality of an operating system which handles or manages primary memory and moves processes back and forth between main memory and disk during execution
Process Address Space
The process address space is the set of logical addresses that a process references in its code
static loading
Is loading an entire program into a fixed address
dynamic loading
dynamic routines of the library are stored on a disk in relocatable form and are loaded into memory only when they are needed by the program.
static linking
the linker combines all other modules needed by a program into a single executable program to avoid any runtime dependency.
dynamic linking
it is not required to link the actual module or library with the program, rather a reference to the dynamic module is provided at the time of compilation and linking
Memory allocation techniques
1.Swapping
2.Fragmentation
*internal and external
3.Paging
4.Segmentation
5.Contiguous Allocation
*Single-Contigous Allocation
*Fixed partitioning
*Dynamic partitioning
6.Virtual memory
Swapping
it is a process of temporarily inti secondary memory from main memory
Fragmentation
As processes are loaded and removed from memory, the free memory space is broken into little pieces. It happens after sometimes that processes cannot be allocated to memory blocks considering their small size and memory blocks remains unused
External fragmentation
Total memory space is enough to satisfy a request or to reside a process in it, but it is not contiguous, so it cannot be used
Internal fragmentation
Memory block assigned to process is bigger.
Some portion of memory is left unused, as it cannot be used by another process.
Paging
Is when process address space are broken into blocks of the same size
single contiguous allocation
the entire memory is allocated to a single process
fixed partitioning
memory is dived into fixed sizes ang is allocated to a single process
dynamic partitioning
memory is divided into variable sizes
disadvantages of paging
*Suffers from internal fragmentation
*Page table requires extra memory space, so may not be good for a system having small RAM.
advantages of paging
reduces external fragmentation
it is easy to implement
it is easy to do swapping
virtual memory
it allows processes to run even when main memory is finished up
First In First Out (FIFO) Algorithm
Oldest page in main memory is the one which will be selected for replacement.
Optimal Page Algorithm
Replace the page that will not be used for the longest period of time. Use the time when a page is to be used.
Least Recently Used (LRU) Algorithm
Page which has not been used for the longest time in main memory is the one which will be selected for replacement
segmentation
memory is divided into several segments of diff sizes
Least Frequently Used (LFU) Algorithm
- The page with the smallest count is the one which will be selected for replacement.
- This algorithm suffers from the situation in which a page is used heavily during the initial phase of a process, but then is never used again
objectives of memory
optimal utilization
isolation and protection
address space abstraction
fragment minimization