Difference between Internal Fragmentation and External Fragmentation


As processes are loaded and removed from memory, the free memory space is broken into little pieces. It may so happen after sometime that processes cannot be allocated to memory blocks considering their small size and memory blocks remain unused. This problem is known as Fragmentation.

There are two types of fragmentation namely, Internal Fragmentation and External Fragmentation. Read this article to learn more about these two types of fragmentation and how they are different from each other.

What is Internal Fragmentation?

Internal fragmentation is defined as the difference between memory allocated and the memory space required by a process. Internal fragmentation occurs when the size of a process is larger than the memory required.

In internal fragmentation, a memory block assigned to a process is bigger. Some portion of the memory is left unused, as it cannot be used by another process. Also, the problem of internal fragmentation occurs when the memory is divided into fixsized partitions. The problem of internal fragmentation can be reduced by effectively assigning the smallest partition but large enough for the process.

What is External Fragmentation?

External fragmentation is the unused space that is left between the fragments of non-contiguous memory. These unused spaces are too small to help a new process. The total memory space is enough to satisfy a request or to reside a process in it, but it is not contiguous, so it cannot be used.

External fragmentation occurs when the total memory is divided into memory partitions of variable size. The size of these partitions depend upon the sizes of the processes.

External fragmentation can be reduced by compaction or by shuffling the memory contents to place all the free memory together in one large block. To make compaction feasible, relocation should be dynamic.

Difference between Internal Fragmentation and External Fragmentation

The following are the important differences between Internal Fragmentation and External Fragmentation −

Key

Internal Fragmentation

External Fragmentation

Definition

When there is a difference between required memory space vs allotted memory space, problem is termed as Internal Fragmentation.

When there are small and non-contiguous memory blocks which cannot be assigned to any process, the problem is termed as External Fragmentation.

Memory Block Size

Internal Fragmentation occurs when allotted memory blocks are of fixed size.

External Fragmentation occurs when allotted memory blocks are of varying size.

Occurrence

Internal Fragmentation occurs when a process needs more space than the size of allotted memory block or use less space.

External Fragmentation occurs when a process is removed from the main memory.

Solution

Best Fit Block Search is the solution for internal fragmentation.

Compaction is the solution for external fragmentation.

Process

Internal Fragmentation occurs when Paging is employed.

External Fragmentation occurs when Segmentation is employed.

Conclusion

The most significant difference that you should note here is that internal fragmentation occurs in memory when the allotted memory blocks are of fixed size, whereas external fragmentation occurs when the allotted memory blocks are of varying size.

Updated on: 07-Nov-2023

46K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements