OS-Fragmentation
OS-Fragmentation
Topperworld.in
fregmentation in os
Fragmentation
• Fregmentation is an unwanted problem in the operating system in
which the processes are loaded and unloaded from memory, and free
memory space is fragmented.
• Processes can't be assigned to memory blocks due to their small size,
and the memory blocks stay unused.
• It is also necessary to understand that as programs are loaded and
deleted from memory, they generate free space or a hole in the
memory.
• These small blocks cannot be allotted to new arriving processes,
resulting in inefficient memory use.
• The conditions of fragmentation depend on the memory allocation
system.
• As the process is loaded and unloaded from memory, these areas are
fragmented into small pieces of memory that cannot be allocated to
incoming processes. It is called fragmentation.
©Topperworld
Operating System
Fixed Partitioning:
In the diagram above you can see that we have 4 blocks of fixed size.
Now since the number of partitions/blocks is fixed, the number of processes
that can reside in the main memory is also fixed and at max, it can be equal
to the number of partitions/blocks. Hence the degree of multiprogramming
in fixed partitioning is limited to the number of partitions/blocks in the main
memory.
©Topperworld
Operating System
Dynamic Partitioning:
Types of Fragmentation
There are mainly two types of fragmentation in the operating system. These
are as follows:
➢ Internal Fragmentation
➢ External Fragmentation
©Topperworld
Operating System
Internal Fragmentation:
©Topperworld
Operating System
External Fragmentation
• External fragmentation happens when a dynamic memory allocation
method allocates some memory but leaves a small amount of memory
unusable.
• The quantity of available memory is substantially reduced if there is too
much external fragmentation.
• There is enough memory space to complete a request, but it is not
contiguous. It's known as external fragmentation.
For Example:
In the above diagram, you can see that there is sufficient space (50 KB)
to run a process (05) (need 45KB), but the memory is not contiguous. You
can use compaction, paging, and segmentation to use the free space to
execute a process.
©Topperworld
Operating System
©Topperworld