Both internal and external classification influence the speed of access to system data. They have a fundamental difference between them, namely the internal fragmentation yes verifies when fixed size memory blocks are allocated to the process without worrying about the size of the process and the external fragmentation yes verifies when processes are allocated to memory dynamically. Let's go further and discuss the differences, the reasons, the solutions behind internal and external fragmentation with the help of the comparison table shown below.
|Basic||Occurs when fixed-size memory blocks are allocated to processes.||Occurs when the variable size memory space is assigned to processes dynamically.|
|event||When the memory assigned to the process is slightly larger than the memory required by the process, it creates a free space in the assigned block that causes internal fragmentation.||When the process is removed from memory, it creates free space in memory causing external fragmentation.|
|Solution||The memory must be partitioned into blocks of varying sizes and assign the most suitable block to the process.||Compaction, pagination and segmentation.|
Definition of internal fragmentation
Internal fragmentation occurs when the memory is divided into fixed size blocks . Whenever a process request for memory, the fixed size block is assigned to the process. In the event that the memory assigned to the process is slightly larger than the requested memory, the difference between the assigned memory is requested internal fragmentation .
This remaining space within the fixed-size block cannot be allocated to any process as it would not be sufficient to satisfy the process memory request. Let us try to understand internal fragmentation with the help of an example. The memory space divided into blocks of fixed size of 18,464 bytes. Let's say that a process request for 18.460 bytes and a partitioned block with a fixed size of 18.464 bytes assigned to the process. The result is 4 bytes of 18,464 bytes left empty, which internal fragmentation.
The overhead of keeping track of the internal hole created due to internal fragmentation substantially greater than the number of internal holes. The problem of internal fragmentation can be solved sharing the memory in the variable size block and assigning the best sized block to a process that requires memory. However, it will not completely eliminate the problem of internal fragmentation, but will reduce it to some extent.
Definition of external fragmentation
External fragmentation occurs when there is a sufficient amount of memory space to satisfy the memory request of a process. But the process memory request cannot be satisfied because the memory is available in a non-contiguous way. Either the first or optimal memory allocation strategy is applied, causing external fragmentation.
When a process is loaded and removed from memory, free space creates the hole in the memory space, and there are many holes in the memory space, this called external fragmentation. Although the first adaptation and the best adaptation can affect the amount of external fragmentation, it cannot be completely eliminated. Compaction may be the solution for external fragmentation.
The compaction algorithm mixes all the contents of the memory on one side and frees a large block of memory. But the expensive compaction algorithm. There is an alternative solution to solve the problem of external fragmentation that will allow a process to acquire physical memory in a non-contiguous way. The techniques to obtain this solution are paging and segmentation.
Key differences between internal and external fragmentation
- The reason behind the occurrences of internal and external fragmentation that internal fragmentation occurs when the memory is divided into fixed size blocks while external fragmentation occurs when the memory is divided into blocks of variable size .
- When the memory block assigned to the process is slightly larger than the required memory, the free space left in the assigned memory block causes internal fragmentation. On the other hand, when the process is removed from memory, it creates a free space causing a hole in the memory that is called external fragmentation.
- The problem of internal fragmentation can be solved by partitioning the memory into blocks of variable size and assigning the most suitable block to the request process. However, the solution for external fragmentation is compaction, but expensive to implement, so the processes must be authorized to acquire physical memory in a non-contiguous way, to get there we are introduced the technique of paging and segmentation.
The problem of internal fragmentation can be reduced, but it cannot be completely eliminated. Paging and segmentation help to use the freed space due to external fragmentation allowing a process to occupy memory in a non-contiguous way.