Dynamic Partitioning
Dynamic partitioning is also known as variable partitioning. It eliminates the factor of internal fragmentation. In this technique, the size of the partition is declared at the loading time of the process. It does not have a predefined memory partition.
OS itself loads in the first partition. The remaining space is divided into different parts. These parts are known as partitions. Every partition size will be equal to the size of the that incoming process. So, partitions sizes are not similar.
There will be never internal fragmentation in dynamic partition but external fragmentation may exist as explained in below diagram.
2MB unused space in Partition 2 and 1MB unused space in partition 4 leads toward external fragmentation because P8 with size 3MB can’t load. Therefore, we can say this unused space is external fragmentation.
It is not an internal fragmentation because the size of 2MB can be accommodated in partition 2.
Conditions for Dynamic Partitions
We know, the partitions are allocated to process at run time and there is no problem with partition size but the condition is
1. One process cannot reside in more than one partition. (spanning not allowed)
Explain: As there are two empty partitions of 1MB and 4MB in RAM and incoming process size is 5MB then Main memory can’t accommodate it.
Advantages of Dynamic Partitioning over fixed partitioning
1. No Internal Fragmentation
As process size is always equal to partition size then there will be no internal fragmentation.
2. No Limitation of process size
As partition size declare at loading time. So, there is no limitation of process size.
3. Degree of multi-programming is dynamic
Due to the absence of internal fragmentation, more processes can be loaded into the memory at a time
Disadvantages of dynamic partitioning
1. External Fragmentation
If there is no internal fragmentation then it doesn’t mean that there will not be external fragmentation.
Let’s consider there are four processes P1 (2 MB), P2 (6 MB), P3 (3 MB), P4 (4 MB) and P5 (6 MB). These are loaded in the respective partitions 1, 2, 3, 4 and 5 of the main memory.
After some time Process 2 and P4 are completed and their assigned space is free. Now there are two free-space partitions (6 MB and 4 MB) are available in the main memory. After loading of process P6 and P7 in partition 2 and 4 respectively. There is still free space of 2MB and 1MB in partition 2 and 4 respectively. But this free-space cannot load the process 8 of 3 MB into the memory. It is Because of, the free-space exists at different location of main memory.
That’s why, this 3MB free-space leads toward external fragmentation. As showing in the following diagram,
Difference between Fixed Partitioning and Variable Partitioning:
S.NO. |
Fixed partitioning |
Variable partitioning |
1. |
In
multi-programming with fixed partitioning the main memory is divided into
fixed sized partitions. |
In
multi-programming with variable partitioning the main memory is not divided
into fixed sized partitions. |
2. |
Only
one process can be placed in a partition. |
In
variable partitioning, the process is allocated a chunk of free memory. |
3. |
It
does not utilize the main memory effectively. |
It
utilizes the main memory effectively. |
4. |
There
is presence of internal fragmentation and external fragmentation. |
There
is external fragmentation. |
5. |
Degree
of multi-programming is less. |
Degree
of multi-programming is higher. |
6. |
It
is more easier to implement. |
It
is less easier to implement. |
7. |
There
is limitation on size of process. |
There
is no limitation on size of process. |
0 Comments