Os12 Memory Management Part 2 85
Os12 Memory Management Part 2 85
co
1
www.gradeup.co
Content :-
1. Multiprogramming with variable partition
2. Paging
3. Segmentation
One technique for overcoming external fragmentation is compaction, which means to move
the processes in the memory in such a way that the scattered pieces of unused memory
(holes) can be placed together, so that any other process demanding contiguous memory for
it can be use.
Depending upon the situation either of the following three algorithms are used for
selection of a free area of memory to create partition:-
a. First fit and its variant, next fit
b. Best fit
c. Worst fit
a. In first fit , we allocate the first hole that is big enough. Searching can be started either at
the beginning of the set of holes(first fit) or where the previous first fit search ended (Next
fit). We stop searching as we obtain a free hole that is large enough to accommodate the
coming process.
b. In best fit, we allocate the smallest hole that is large enough. Searching of entire list is
done unless it is sorted by size.This strategy produces least size of unused memory
space(fragments).
c. In worst case , we allocate the largest hole. Again we search the entire list, unless it is
sorted by size. This strategy procures largest size of unused memory space.
Note: - first fit and Best fit is better that worst fit in terms of deceasing both time and
storage utilization . Neither first fit nor best fit can be said better in terms of storage utilization
as they again results to external fragmentation. One of the solution is compaction but it is
time consuming approach another possible solution is to permit the logical address space of
a process to be non-contiguous. Thus allowing a process to be allocated in physical memory
.
2
www.gradeup.co
Where ‘P’ is the index number in the page table and ‘d’ is the offset value(displacement)
Note:- If the page size is not the power of 2 then separation of ‘p’ and ‘d’ is not possible.
3
www.gradeup.co