Open In App

Variable (or Dynamic) Partitioning in Operating System

Last Updated : 04 Dec, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

In operating systems, Memory Management is the function responsible for allocating and managing a computer’s main memory. The memory Management function keeps track of the status of each memory location, either allocated or free to ensure effective and efficient use of Primary Memory.

Below are Memory Management Techniques.

  • Contiguous
  • Non-Contiguous

In the Contiguous Technique, the executing process must be loaded entirely in the main memory. The contiguous Technique can be divided into:

  • Fixed (static) partitioning
  • Variable (dynamic) partitioning

What is Variable (Dynamic) Partitioning?

It is a part of the Contiguous allocation technique. It is used to alleviate the problem faced by Fixed Partitioning. In contrast with fixed partitioning, partitions are not made before the execution or during system configuration. Various features associated with variable Partitioning-

  • Initially, RAM is empty and partitions are made during the run-time according to the process’s need instead of partitioning during system configuration.
  • The size of the partition will be equal to the incoming process.
  • The partition size varies according to the need of the process so that internal fragmentation can be avoided to ensure efficient utilization of RAM.
  • The number of partitions in RAM is not fixed and depends on the number of incoming processes and the Main Memory’s size.
Dynamic Partitioning

Dynamic Partitioning

Advantages of Variable(Dynamic) Partitioning

  • No Internal Fragmentation: In variable Partitioning, space in the main memory is allocated strictly according to the need of the process, hence there is no case of internal fragmentation. There will be no unused space left in the partition.
  • No restriction on the Degree of Multiprogramming: More processes can be accommodated due to the absence of internal fragmentation. A process can be loaded until the memory is empty.
  • No Limitation on the Size of the Process: In Fixed partitioning, the process with a size greater than the size of the largest partition could not be loaded and the process can not be divided as it is invalid in the contiguous allocation technique. Here, In variable partitioning, the process size can’t be restricted since the partition size is decided according to the process size.

Disadvantages of Variable(Dynamic) Partitioning

  • Difficult Implementation: Implementing variable Partitioning is difficult as compared to Fixed Partitioning as it involves the allocation of memory during run-time rather than during system configuration.
  • External Fragmentation: There will be external fragmentation despite the absence of internal fragmentation. For example, suppose in the above example- process P1(2MB) and process P3(1MB) completed their execution. Hence two spaces are left i.e. 2MB and 1MB. Let’s suppose process P5 of size 3MB comes. The space in memory cannot be allocated as no spanning is allowed in contiguous allocation. The rule says that the process must be continuously present in the main memory to get executed. Hence it results in External Fragmentation.
No Internal Fragmentation

No Internal Fragmentation

Now P5 of size 3 MB cannot be accommodated despite the required available space because in contiguous no spanning is allowed.

Key Points On Variable (Dynamic) Partitioning in Operating Systems

  • Variable (or dynamic) partitioning is a memory allocation technique that allows memory partitions to be created and resized dynamically as needed.
  • The operating system maintains a table of free memory blocks or holes, each of which represents a potential partition. When a process requests memory, the operating system searches the table for a suitable hole that can accommodate the requested amount of memory.
  • Dynamic partitioning reduces internal fragmentation by allocating memory more efficiently, allows multiple processes to share the same memory space, and is flexible in accommodating processes with varying memory requirements.
  • However, dynamic partitioning can also lead to external fragmentation and requires more complex memory management algorithms, which can make it slower than fixed partitioning.
  • Understanding dynamic partitioning is essential for operating system design and implementation, as well as for system-level programming.

FAQs on Dynamic (Variable) Partitioning

Q.1: What is the basic difference between Fixed Partitioning and Variable Partitioning?

Answer:

Fixed Partitioning helps in creating memory of identical sizes whereas dynamic partitioning helps in creating memory of variable sizes.

Q.2: Which algorithms work best for Dynamic Partitioning?

Answer:

The Worst Fit Algorithm works best for Dynamic Partitioning.

Q.3: What is Data Partitioning?

Answer:

The process of dividing up data among several tables, drives, or locations in order to enhance database manageability or query processing speed is known as data partitioning.


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads