Fragmentation, External Fragementation, Internal Fragmentation in operating systems (OS)

Fragmentation, External Fragmentation, Internal Fragmentation in operating systems (OS)

In this tutorial, we will try to answer the following questions;

What is Fragmentation? What is External Fragmentation? What is Internal Fragmentation? Comparison of external fragmentation VS internal fragmentation?


The user of a computer continuously load and unload the processes from main memory. Processes are stored in blocks of the main memory. When it happens that there are some free memory blocks but still not enough to load the process, then this condition is called fragmentation.

Fragmentation is a condition that occurs when we dynamically allocate the RAM to the processes, then many free memory blocks are available but they are not enough to load the process on RAM.

 There are two types of fragmentation;

  1. External fragmentation
  2. Internal fragmentation

1. External fragmentation

Total free RAM space is enough to load a process but the process still can’t load because free blocks of RAM are not contiguous. In other words, we can say that all free blocks are not located together. For example, in the following diagram, we have a total 10 KB space free but it is not together located, so if a process with 10KB size wants to loads on the RAM, then can’t load due to external fragmentation. But in the diagram on the right side we can see that 10KB space is contiguously free, so here if a process of 10KB wants to load on the RAM then can execute.

external fragmentation
Figure: external fragmentation


Internal fragmentation occurs when fixed sized memory blocks are available and a process gets a block that is too much larger than the storage requirement of a process. The worst fit is mostly a big reason for internal fragmentation.

internal fragmentation memory management operating systems os
Figure: internal fragmentation memory management operating systems os

Comparison of external fragmentation VS internal fragmentation



Basics of fragmentationWhen different size memory blocks are dynamically allocated to the processes.When fixed sized memory blocks are allocated to the processes.
When  fragmentation


When the process releases the RAM, it creates the free space in the RAM which leads to cause external fragmentation.When the memory assigned to the process is greater as compared to the memory requested by the process.
The solution of fragmentationsegmentation. paging and CompactionThe memory must be partitioned into variable sized blocks. Further, assign the best-fit block to the process.