Difference Between Internal Fragmentation vs. External Fragmentation

Main Difference

The difference between internal fragmentation and external fragmentation is that in internal fragmentation fixed sized memory blocks are assigned to process whereas in external fragmentation variable sized memory blocks are assigned to process.

Internal Fragmentation vs. External Fragmentation

A small hole is created in memory space whenever a process is loaded or removed form a physical memory that small hole is known as a fragment. If there occurs a fragmentation, the system fails to allocate the contiguous memory space to a process. There are two types of fragmentation that are internal fragmentation and external fragmentation. The purpose of both internal fragmentation and external fragmentation is that these affects data accessing. The key difference between internal fragmentation and external fragmentation is that in internal fragmentation fixed sized memory blocks are assigned to process whereas in external fragmentation variable sized memory blocks are assigned to process. In external fragmentation, there is a sufficient amount of space in memory to satisfy the memory request of a process. Process’s memory request cannot be satisfied as the memory available is in a non-contiguous manner. External fragmentation occurs when there is a sufficient amount of space in the memory to satisfy the memory request of a process. But the process’s memory request cannot be satisfied as the memory available is in a non-contiguous manner. Either you apply first-fit or best-fit memory allocation strategy it will cause external fragmentation. The solution of external fragmentation is compaction. Compaction shuffles all memory contents to a side; compaction algorithm is expensive. The paging and segmentation are also the solutions of external fragmentation. Internal fragmentation occurs when memory is divided into fixed sized blocks. Any process that comes to the system asks for the memory, in this case, fixed sized block is allocated to that process. The process is somehow larger than the memory then the difference between assigned and requested memory is called internal fragmentation. The space that is leftover cannot be allocated to any process in internal fragmentation. For example, memory space is divided into fixed sized blocks of 18,468 bytes then 18,464 bytes are allocated to the program, and 4 bytes are remained empty. Internal hole is created due to the internal fragmentation that keeps track of memory. Internal fragmentation is a problem, and that can be solved by partitioning the memory into the variable sized block.

Comparison Chart

BasisInternal fragmentationExternal fragmentation
MeaningIn internal fragmentation fixed sized memory blocks are assigned to processIn external fragmentation variable sized memory blocks are assigned to process.
OccurrenceInternal fragmentation occur when process is larger than memory.External fragmentation occur when process is removed
SolutionSolution of internal fragmentation is best fit blockSolution of external fragmentation is paging and segmentation

What is internal fragmentation?

Internal fragmentation occurs when memory is divided into fixed sized blocks. Any process that comes to the system asks for the memory, in this case, fixed sized block is allocated to that process. The process is somehow larger than the memory then the difference between assigned and requested memory is called internal fragmentation. The space that is leftover cannot be allocated to any process in internal fragmentation. For example, memory space is divided into fixed sized blocks of 18,468 bytes then 18,464 bytes are allocated to the program, and 4 bytes are remained empty. Internal hole is created due to the internal fragmentation that keeps track of memory. Internal fragmentation is a problem, and that can be solved by partitioning the memory into the variable sized block.

What is External fragmentation?

In external fragmentation, there is a sufficient amount of space in memory to satisfy the memory request of a process. Process’s memory request cannot be satisfied as the memory available is in a non-contiguous manner. External fragmentation occurs when there is a sufficient amount of space in the memory to satisfy the memory request of a process. But the process’s memory request cannot be satisfied as the memory available is in a non-contiguous manner. Either you apply first-fit or best-fit memory allocation strategy it will cause external fragmentation. The solution of external fragmentation is compaction. Compaction shuffles all memory contents to a side, compaction algorithm is expensive. The paging and segmentation are also the solutions of external fragmentation. The operating system is a bridge between user and software, in operating system memory management is one of the essential functions that allows the allocation of memory. The operating system also allocates memory and deallocate memory when the process no longer exists. Two most important concept of the operating system is paging and segmentation, in paging, the page is of fixed block size whereas in segmentation page is of the variable block size. In paging process is allowed to store in memory and is a memory management scheme. Paging gives non-contiguous memory to the process. There is no external fragmentation in paging. In paging, physical and logical memory space is divided into same side memory blocks. In paging, the fixed sized blocks are known as frames, and fixed size block of logical memory is called a page. In paging, the process needs to be executed from logical memory space. There are two addresses that are generated by CPU in paging that is page number and page offset. In segmentation process is divided into two variable size segments and variable size segments are loaded into logical memory address space. Segmentation is memory management scheme in which page is of the variable block size. Logical address space has variable size segments. There are a name and length of each segment. Segments are loaded into physical memory space. The address of physical memory space is segmented name and offset. There is segment number that is used in segmentation in the place of segment name. There is an index in segmentation.

Key Differences

  1. In internal fragmentation fixed sized memory blocks are assigned to process whereas in external fragmentation variable sized memory blocks are assigned to process.
  2. Internal fragmentation occurs when the process is larger than memory whereas External fragmentation occurs when the process is removed.
  3. A solution of internal fragmentation is best fit block whereas the solution of external fragmentation is paging and segmentation

Comparison Video

Posted in: IT