What is Fragmentation?

Some time it seems confusing to the students to understand the exact difference between internal and external fragmentation. Before knowing the difference between internal and external fragmentation we need to understand the meaning of fragmentation in the context of memory. So let see here what is fragmentation

Fragmentation refers to the unused memory that the memory management system cannot allocate. It is of two types: External and Internal.

Difference between External and Internal Fragmentation

External Fragmentation is waste of memory between partitions caused by scattered non-contiguous free space. It occurs when total available memory space is enough to satisfy the request for a process to be allocated, but it is not continuous. Selection of first fit and best fit can affect the amount of fragmentation. It is severe in variable size partitioning schemes. Compaction is a technique that is used to overcome this.

Internal fragmentation the is waste of memory within a partition caused by difference between size of partition and the process allocated. It refers to the amount of memory, which is not being used and is allocated along with a process request i.e. available memory internal to partition. It is severe in fixed partitioning schemes.
Internal fragmentation can be decreased by choosing smallest partition which can hold a process.

User space can be partitioned into fixed size partition and variable size partitions.

Compaction : Compaction is   technique to reduce the external fragmentation.  In Compaction technique all the free memory space which is scattered here and there is bring together at one place. But it not a good solution of external fragmentation.

Keywords: definition of fragmentation, difference between external and internal fragmentation,