Type Here to Get Search Results !

Difference Between Internal and External Fragmentation

Internal and External Fragmentation is an important problem that arises during memory management. This problem affects the use of memory and can reduce the efficiency of the system. 

There are two types of fragmentation: internal fragmentation and external fragmentation. Let us understand the difference between these two in detail.

What is Internal Fragmentation? 

Internal fragmentation is a major problem that arises during memory management. This problem occurs when some part of the memory remains unused even though it has been allocated. This situation mainly arises when the allocated memory block is larger than the required memory.

When a part of a memory block remains idle and not used, it is called internal fragmentation. This happens when the allocated memory block is larger than the required memory.

Internal fragmentation is a major memory management problem in operating systems, which can affect the system's efficiency. To avoid this problem, it is necessary to use the right memory management techniques and algorithms. 

By understanding the problem of internal fragmentation and adopting appropriate measures, we can make maximum use of memory and increase the system's efficiency.

Definition of Internal Fragmentation

Internal fragmentation is a situation when some part of the memory block remains inactive or useless because the size of the allocated memory block is more than the requirement. 

This problem is common in Fixed Size Partitioning, where memory is divided into blocks of predetermined size.

Example of Internal Fragmentation

Suppose a process needs 100 KB of memory, but the memory manager allocated a block of 120 KB. In this case, the extra 20 KB of memory becomes useless. This 20 KB is called internal fragmentation.

Characteristics

  • Inside memory: This problem occurs inside memory blocks.
  • Fixed size partitioning: This mainly occurs in fixed size partitioning.
  • Residual memory: Residual memory is not used.

Causes of Internal Fragmentation

  • Fixed Size Partitioning: When memory is divided into blocks of predetermined size, more memory than the process needs may be allocated.
  • Process Size and Block Size: The size of a process does not always match the size of the memory block, causing internal fragmentation.

Effects of Internal Fragmentation

  • Waste of Memory: Some part of the allocated memory becomes unusable, causing memory wastage.
  • Decreased System Performance: System performance is reduced due to the ineffective use of available memory.
  • Degraded User Experience: User experience is negatively affected due to processes not getting the required memory.

Tips to Avoid Internal Fragmentation

  • Dynamic Memory Allocation: Allocating memory as per the requirement, thereby eliminating the need for fixed size blocks.
  • Improved Memory Management Techniques: Making the size of memory blocks small and useful.
  • Big System Allocation: In this, memory is divided into blocks of different sizes, thereby reducing internal fragmentation.

What is External Fragmentation? 

In computer science and operating systems, external fragmentation is a major problem that arises during memory management. 

This situation arises when there are small empty blocks in the memory, which together cannot form a large block of the required size. External fragmentation can affect the system's performance and reduce the effective use of memory.

When memory contains small empty blocks which cannot combine to form a large block of required size, it is called external fragmentation. It occurs when allocated and empty blocks are scattered mixedly in memory.

External fragmentation is a significant problem in operating systems that can reduce the effective use of memory. The use of proper memory management techniques and algorithms is essential to manage it. 

By understanding external fragmentation and adopting suitable measures, we can make maximum use of memory and increase the efficiency of the system.

Definition of External Fragmentation

External fragmentation is a situation when there are small empty blocks in the memory, which together are sufficient memory, but are not available as a large and continuous block. Due to this, large processes are unable to get the required memory and the system's performance is affected.

Example of External Fragmentation

Suppose there are 3 empty blocks in the memory, whose size is 10 KB, 20 KB and 15 KB respectively. If a process needs 25 KB of memory, it cannot fit into these small blocks, even if the total free memory (10 KB + 20 KB + 15 KB = 45 KB) is sufficient.

Causes of External Fragmentation

  • Variable Size Partitioning: When memory is divided into variable size blocks, small empty blocks are generated over time.
  • Memory Allocation and Deallocation: The empty blocks get scattered as processes allocate and deallocate memory frequently.

Effects of External Fragmentation

  • Memory Idleness: Small blocks of memory remain unused, leading to memory being unused.
  • Degraded Performance: Decreased system performance as large processes are not able to get the required memory.
  • Degraded User Experience: User experience is affected due to unavailability of memory.

Measures to Avoid External Fragmentation

  • Memory Compaction: Bringing the free space together by rearranging memory blocks.
  • Improved Allocation Algorithms: Like using First Fit, Best Fit and Worst Fit algorithms.
  • Swapping Technique: Taking some processes out of memory and placing them on disk and bringing them back as required.

Solutions to External Fragmentation

  • Buddy System: In this memory is divided into equal blocks, which reduces the number of small blocks.
  • Paging and Segmentation: Dividing memory into smaller pages or segments, which reduces external fragmentation.

Characteristics

  • Outside memory: This problem occurs between memory blocks.
  • Variable size partitioning: This mainly occurs in variable size partitioning.
  • Total memory loss: A block equal to the required memory size cannot be found.

Difference Between Internal and External Fragmentation

Internal FragmentationExternal Fragmentation
Occurs when fixed-sized memory blocks are allocated and a portion of the block remains unused.Occurs when free memory is scattered in small blocks between allocated memory, making it hard to allocate to new processes.
Due to fixed-sized memory allocation.Due to dynamic memory allocation.
Wastes memory within allocated blocks.Wastes memory between allocated blocks.
A process needs 5 KB of memory but is allocated a 8 KB block, leaving 3 KB unused.Several small blocks of free memory exist, but none are large enough for a new process needing a large block.
Use dynamic memory allocation or variable-sized blocks.Use memory compaction to combine free spaces or use paging and segmentation.

Conclusion

Both internal and external fragmentation are memory management problems that affect the system's efficiency. Internal fragmentation occurs in fixed size partitioning, while external fragmentation occurs in variable size partitioning. 

To solve these problems, it is necessary to use proper memory management techniques and algorithms.

Through these techniques, we can make maximum use of memory and increase the system's efficiency. Understanding the problems of fragmentation and finding solutions to them is an important part of operating system design.

Post a Comment

0 Comments