GATE CSE IT » Difference Between Internal and External Fragmentation

Difference Between Internal and External Fragmentation

The free memory becomes fragmented as processes are loaded and unloaded from memory. Because of their tiny size, functions cannot be assigned to memory blocks, leaving such blocks empty. This issue is referred to as fragmentation.

What exactly is fragmentation?

When memory space is misused for data storage, ability or efficiency might be reduced, and occasionally both. The impact of fragmentation is determined by the individual fragmentation type and the unique storage space allocation strategy in use. The word also refers to the wasted space generated when fragmentation increases “unused” storage capacity. Regardless of the degree of fragmentation, the RAM used to retain the data set (- for example, file format) is equivalent for other systems (- for example, the FAT file system) (from null to the extreme).

The Basic Idea of Fragmentation

The operating system (OS) allows the storage of components in chunks when a computer programme demands them. After completing a segment of the software programme, it can be put back into the system and moved to the following or a related programme. The software retains chunks for varying lengths of time and in different sizes. A computer programme can request and release several storage blocks during its existence.

The unused memory areas are large and continuous when a system first starts. The enormous continuous sectors break up through time and utilisation into smaller sections of the land. Large continuous blocks of storage can ultimately become difficult to access.

Internal Fragmentation

The process has a bigger memory block assigned to it. Since another process cannot use it, some memory is left unused. Nevertheless, the lowest partition that is big enough for the process might be chosen to reduce internal fragmentation.

External Fragmentation

The total amount of memory is adequate to handle a request or house a process, but it cannot be used because it is not contiguous. By compacting or rearranging the memory’s contents to group all of the Memory that is accessible into a single big block, external fragmentation can be eliminated. To enable compaction, dynamic displacement is needed.

The key distinction between Internal and External Fragmentation

Internal Fragmentation External Fragmentation
Internal Fragmentation occurs when paging is employed. External fragmentation occurs when segmentation is applied.
Best Fit Block Search can be used to fix internal fragmentation. Compaction can be used to repair external fragmentation.
Internal fragmentation occurs when a process utilises less or more space than the assigned memory block size. When a process is deleted from the main memory, external fragmentation happens.
When allocated memory chunks have a fixed size, internal fragmentation results. External fragmentation occurs when memory portions allocated are of varying sizes.
The problem is called internal fragmentation, when there is a mismatch between the assigned and necessary memory space. External fragmentation occurs when there are small, non-contiguous memory pieces that cannot be assigned to any process.

Variations of Fragmentation

When we divide the memory into little blocks, it fragments. Fragments are also inherently non-contiguous. Therefore, we are unable to assign them to processes. As a result, while processes are pending in the queue and awaiting memory, some unused blocks will be in memory. Both internal and external fragmentation is possible.

  • Internal fragmentation happens when we allocate memory for a process that may be bigger than the requested memory and divide the physical memory into contiguous mounted-sized chunks. As a result, the space that wasn’t used can no longer be used by other processes. The remedy for internal fragmentation is a best-fit block search.
  • External fragmentation happens when there is enough unused RAM to accommodate all allocation requests. The memory is not continuous in this case. As a result, the RAM includes several vacant blocks too small to be assigned to other applications. The remedy for external fragmentation is compaction.

Fragmentation of operating systems

Processes are given space in the computer’s storage system when loaded. This space is divided between fixed partitioning (in which the size of partitions is fixed before any process is loaded into memory) and dynamic partitioning (where the size of partitions is decided at the run time, and it is mainly according to the size of the process) (where the size of partitions is decided at the run time and it is primarily according to the size of the process).

Processes are eliminated from memory in the same way as they are added to it, fragmenting the available free space. This primarily results in tiny, underutilised fragmented memory locations that are too small to support usual activities.