Fragmentation in OS: Internal Fragmentation and External Fragmentation

Fragmentation is a process of data storage in which memory space is used inadequately, decreasing ability or efficiency and sometimes both." The precise implications of fragmentation depend on the specific storage space allocation scheme in operation and the particular fragmentation type. In certain instances, fragmentation contributes to "unused" storage capacity, and the concept also applies to the unusable space generated in that situation. The memory used to preserve the data set (- for example file format) is similar for other systems (- for example, the FAT file system), regardless of the amount of fragmentation (from null to the extreme).



Internal Fragmentation

Internal Fragmentation is a problem that occurs when the process is allocated to a memory block whose size is more than the size of that process and due to which some part of the memory is left unused. Thus the space wasted inside the allocated memory block is due to the restriction on the allowed sizes of allocated blocks.




Solution

The solution of internal fragmentation is the best-fit block.


Best -Fit Block

This method keeps the free/busy list in order by size – smallest to largest. In this method, the operating system first searches the whole of the memory according to the size of the given job and allocates it to the closest-fitting free partition in the memory, making it able to use memory efficiently. Here the jobs are in the order from smallest job to largest job.



External Fragmentation

When the memory space in the system can easily satisfy the requirement of the processes, but this available memory space is non-contiguous, So it can’t be utilized further. Then this problem is referred to as