2. Fragmentation
1. Fragmentation occurs when memory is allocated dynamically .
2. When a process arrives it gets the desired memory from the block of available memory
known as Hole.
3. As processes are loaded and removed from memory the hole is divided into small pieces
known as fragments.
For example
Consider the available memory(Hole) is of 16 kb. Three Processes P1,P2,P3 of 4,6,2kb
respectively loaded into the memory.
As they come they break 16kb memory into 4 fragments of size 4,6,2kb occupied by three
processes and one fragment of free space i.e. 4kb.
www.advanced.edu.in
3. Diagram
showing
Fragmentation
Memory (16 kb) Memory is divided into 4 fragments
This diagram shows how fragments
are formed
www.advanced.edu.in
P1(4kb)
P2(6kb)
P3(2kb)
Free space(4kb)
4. External Fragmentation
www.advanced.edu.in
1. External Fragmentation occurs when there is enough total memory space to satisfy the request of
coming process but the available space is not contiguous.
2. For example consider the previous problem in this if process P1 is removed from the memory .
3. The space that was occupied by P1 is now free.
4. Now we have two free fragments of 4kb each.
5. Total free space available is 8 kb .
We have 8 kb free space. If a process P5 of 6kb comes, than also we cant provide space to that process
because that 8kb free space is not contiguous. And P5 requires 6kb consecutively.
5. General example of this problem can also be seen as space
between two vehicles that is wasted.
www.advanced.edu.in
Free Space(4kb)
P2(6kb)
P3(2kb)
Free space(4kb)
8kb free space is there but request of Process P5 can’t be fulfill as memory is not
consecutively free. So this problem waste the main memory.
6. Solution to External Fragmentation
Problem
www.advanced.edu.in
1. Compaction: In this method shuffling of memory is done such that all occupied
memory is gather at one place and free memory at other end. But this solution is
difficult to implement practically.
2. Use Non-Contiguous Memory in place of Contiguous Memory this can be done by
(a) Paging
(b) Segmentation
7. Internal Fragmentation
Internal Fragmentation is the wastage of memory within the fragment that is allotted to the
process.
For example
Consider if a Process P6 is of 2kb and we have free space fragment of 4kb .Then 2kb is
wasted as the P6 occupied that fragment which is only of 2kb.
Such wastage of Memory is called Internal Fragmentation
P6(2kb)
Free
space(2
kb)
Internal Fragmentation
www.advanced.edu.in