Difference between internal and external fragmentation in operating system

Поділитися
Вставка
  • Опубліковано 25 лип 2017
  • In this video i will be explaining the difference between internal and external fragmentation or two types of fragmentation based on memory management techniques.
    Internal Fragmentation
    1)When a process is allocated more memory than required, few space is left unused and this is called as INTERNAL FRAGMENTATION.
    2)It occurs when memory is divided into fixed-sized partitions.
    3) It can be cured by allocating memory dynamically or having
    partitions of different sizes.
    External Fragmentation
    1)After execution of processes when they are swapped out of memory and other smaller processes replace them, many small non contiguous(adjacent) blocks of unused spaces are formed which can serve a new request if all of them are put together but as they are not adjacent to each other a new request can't be served and this is known as EXTERNAL FRAGMENTATION.
    2)It occurs when memory is divided into variable-sized partitions based on size of process.
    3)It can be cured by Compaction, Paging and Segmentation.
    Internal Fragmentation
    1)It arises when we use fixed sized partitioning.
    2)Some part of the memory is kept for operating system and the rest is available for user space.
    3)In this case the user space is divided into blocks of 10 KB each.
    When process 1 with size 8 KB is allocated a block of 10 KB, 2 KB space is left unused. When process 2 with size 10 KB is allocated a !0 KB block no space is left unused. When process 3 with size 9KB is allocated a 10 KB block, 1KB is left unused.
    4)Here 2 processes are allocated space more than required and this unused space is so small to store a new process and is wasted. This is called as INTERNAL FRAGMENTATION.
    External Fragmentation
    1)It arises when dynamic partitioning technique is used.
    2)Here memory is allocated to the processes dynamically based on their size.
    3)So in the above example, the user space contains processes 1,2 & 3 Out of which process 1 & 3 complete their execution and are swapped out and two other processes, process 4 & 5 are swapped in their places.
    4)Process 4 takes place of process 1 but as its size is only 8 KB, it is allocated only 8 KB and rest is left unused.
    Process 5 takes place of process 3. It is allocated 6 KB space and 8 KB is left unused.
    5)Now suppose a new process, process 6 wants to be swapped in and its size is 6 KB. Though we have total 6 KB space but we cannot service this request as these blocks are not contiguous(adjacent). This is called as EXTERNAL FRAGMENTATION.

КОМЕНТАРІ • 32