FREE SPACE MANAGEMENT TECHINIQUES
Memory management is the functionality of an operating system which handles or manages
main memory (RAM) and moves processes back and forth between main memory and disk
during execution.
It keeps track of each and every memory location and It checks how much memory is to be
allocated to processes
It decides which process will get memory at what time
It tracks whenever some memory gets freed or unallocated and correspondingly it updates
the status.
Memory Allocation Techniques are classified into two categories:
Contiguous Techniques
a method which allocates consecutive blocks of memory to a process
Non-contiguous Techniques
a method which allocates the memory space present in different locations to the
process as per it’s requirements
FREE SPACE MANAGEMENT TECHINIQUES
CONTIGUOUS MEMORY MANAGEMENT
Single contiguous memory allocation
Simple allocation scheme
No multiprogramming
Entire available memory is allocated to a single process
Main memory is divided into 2 contiguous regions:
One portion permanently allocated to OS
Remaining portion of memory is allocated to
single user process
Some part of memory gets wasted
Advantages:
Fast access time
Requires less memory
Easy to implement and use
Disadvantages:
No multi user facility
Memory is not fully utilised
Processor is also not fully utilised
User program is being limited to the size available in main memory
FREE SPACE MANAGEMENT TECHINIQUES
Fixed partitioning
Number of partitions in memory are fixed but size of each partition may or may not be
same.
As it is contiguous allocation, hence no spanning is allowed.
Partition are made before execution or during system configure
simplest technique used to put more than one processes in the main memory
Advantages:
Easy to implement
Little OS overhead
Disadvantages:
Internal Fragmentation
External Fragmentation
Limited process size
Limitation on Degree of Multiprogramming
FREE SPACE MANAGEMENT TECHINIQUES
Internal fragmentation
Internal fragmentation happens when the memory is split into mounted-sized blocks.
Whenever process is requested for the memory, the mounted-sized block is allotted to it
In the case where the memory allotted to the process is somewhat larger than the memory
requested, then the difference between allotted and requested memory is called internal
fragmentation
External fragmentation
External fragmentation happens when there’s a sufficient quantity of area within the
memory to satisfy the memory request of a process.
However, the process’s memory request cannot be fulfilled because the memory offered is
in a non-contiguous manner.
FREE SPACE MANAGEMENT TECHINIQUES
Variable partitioning
Initially main memory is empty and partitions are made during the run-time according to
process’s need instead of partitioning during system configure
The size of partition will be equal to incoming process
Internal fragmentation can be avoided to ensure efficient utilisation of memory
Number of partitions are not fixed and depends on the number of incoming process and
Main Memory’s size
Advantages of Variable Partitioning –
No Internal Fragmentation
No restriction on Degree of Multiprogramming
No Limitation on the size of the process
Disadvantages of Variable Partitioning –
Difficult Implementation
External Fragmentation
FREE SPACE MANAGEMENT TECHINIQUES
NON CONTIGUOUS MEMORY MANAGEMENT
In non-contiguous memory allocation, different parts of a process is allocated different
places in Main Memory
Spanning is allowed
In non-contiguous allocation, Operating system needs to maintain the table for each
process which contains the starting address of the each block which is acquired by the
process in memory space
Two ways which allows non-contiguous way of memory allocation:
Paging
Segmentation
Paging
Paging is a mechanism used to retrieve processes from the secondary
storage into the main memory in the form of pages.
In this technique, each process is divided in the form of PAGES
The main memory will also be divided in the form of FRAMES
One page of the process is to be stored in one of the frames of the
memory.
Pages of the process are brought into the main memory only when they
are required otherwise they reside in the secondary storage.
FREE SPACE MANAGEMENT TECHINIQUES
Considering the fact that the pages are mapped to the frames , PAGE
SIZE NEEDS TO BE AS SAME AS FRAME SIZE.
WHY SEGMENTATION IS REQUIRED??
Paging is more close to Operating system rather than the User.
Operating system doesn't care about the User's view of the process. It may divide
the same function into different pages and those pages may or may not be loaded
at the same time into the memory.
It is better to have segmentation which divides the process into the segments. Each
segment contain same type of functions such as main function can be included in
one segment and the library functions can be included in the other segment
Pages are physical in nature and Segments are logical divisions of a process
Segments are variable in size
Each program is divided into logical parts-SEGMENTS
The details about each segment are stored in a table called as segment table