Oops! It appears that you have disabled your Javascript. In order for you to see this page as it is meant to appear, we ask that you please re-enable your Javascript!

Fragmentation, External Fragmentation, Internal Fragmentation, first fit, best fit, worst fit in operating systems (OS)

Last modified on December 23rd, 2018 at 7:35 am

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

In this tutorial, we will try to learn the followings;

  1. Fragmentation
  2. External Fragmentation with examples
  3. Internal Fragmentation with examples 


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.

First-fit memory allocation
In first-fit memory allocation, OS Allocate the first hole to the process that is big enough and process size is less.

Best-fit memory allocation
In best-fit memory allocation, OS Allocate the most suitable smallest hole to the process. In best-fit memory, waste is less as compared to the worst fit and first, fit memory allocations.

Worst-fit memory allocation
In Worst-fit memory allocation, OS Allocate the largest hole to the process and results in wastage of a large amount of memory.

Prof. Fazal Rehman Shamil
Researcher, Publisher of International Journal Of Software Technology & Science ISSN: 2616-5325
Instructor, SEO Expert, Web Programmer and poet.
Feel free to contact.