CoursifyCoursify

Fixed Partition vs Variable Partition in Operating Systems, and the Need for Compaction

Fixed Partition vs Variable Partition in Operating Systems, and the Need for Compaction

Verified Sources
May 27, 2026

In memory partitioning, the operating system assigns each process to a contiguous region of RAM. Two classic contiguous allocation methods are fixed partitioning and variable partitioning. The essential difference is that fixed partitioning creates partitions in advance, while variable partitioning creates them on demand to better match process sizes.2

In fixed partitioning, main memory is split into a fixed number of partitions, each capable of holding at most one process. A process must fit entirely inside one available partition of equal or greater size. In variable partitioning, partitions are not predetermined; instead, the OS allocates a block approximately equal to the process's size when the process arrives, improving utilization.2

The trade-off is fragmentation. Fixed partitioning commonly suffers from internal fragmentation, because a process may be smaller than the partition assigned to it.2 Variable partitioning largely removes internal waste, but over time creates external fragmentation, where total free space may be sufficient yet no single contiguous block is large enough for a new process.2 This leads directly to the need for compaction, a technique that merges dispersed free holes into one larger usable region.2

Footnotes

  1. Difference between Fixed Partitioning and Variable Partitioning - GeeksforGeeks - Overview of definitions, features, and comparison. 2

  2. CSC 553 Operating Systems - Lecture 7 - Memory Management - Lecture notes explaining dynamic partitioning, compaction, and relocation cost. 2

  3. Memory Management in Operating System - GeeksforGeeks - Summary of partitioned memory allocation and fixed partition characteristics. 2

  4. Variable (or Dynamic) Partitioning in Operating System - GeeksforGeeks - Explanation of dynamic partitioning and its motivation. 2

  5. Difference between Internal and External Fragmentation - GeeksforGeeks - Clarifies internal vs external fragmentation and the role of compaction. 2

  6. Implementation of Contiguous Memory Management Techniques - GeeksforGeeks - Discusses fixed/variable partition schemes, placement algorithms, and fragmentation handling.

Memory Partitioning Explained: Fixed vs Variable Techniques for Beginners

Core Distinction

Fixed partitioning decides partition boundaries before processes run, while variable partitioning creates boundaries as processes arrive.2

Footnotes

  1. Difference between Fixed Partitioning and Variable Partitioning - GeeksforGeeks - Overview of definitions, features, and comparison.

  2. Memory Management in Operating System - GeeksforGeeks - Summary of partitioned memory allocation and fixed partition characteristics.

Fixed Partitioning

In fixed partitioning, memory is divided into a predetermined number of static partitions during system setup or initialization.2 These partitions may be equal-sized or unequal-sized, but their count and boundaries do not change during execution. Since each partition holds only one process, the degree of multiprogramming is limited by the number of partitions.2

The chief advantage of this scheme is simplicity. The OS bookkeeping is relatively small, allocation is straightforward, and implementation overhead is low.2 However, it wastes memory when process sizes do not match partition sizes. If a 20 KB20\text{ KB} process is placed into a 32 KB32\text{ KB} partition, the unused 12 KB12\text{ KB} inside that partition is lost to internal fragmentation.2

A second limitation is process size restriction. If the largest partition is smaller than a process, that process cannot be loaded at all, even if total free memory across partitions is sufficient.2 Thus, fixed partitioning is simple but inflexible.

AspectFixed Partitioning
Partition creationPredefined before execution
Partition sizeFixed
Allocation styleOne process per partition
Main waste patternInternal fragmentation
Multiprogramming limitNumber of partitions
ImplementationEasy

Footnotes

  1. Difference between Fixed Partitioning and Variable Partitioning - GeeksforGeeks - Overview of definitions, features, and comparison.

  2. Memory Management in Operating System - GeeksforGeeks - Summary of partitioned memory allocation and fixed partition characteristics. 2 3 4 5 6

  3. Implementation of Contiguous Memory Management Techniques - GeeksforGeeks - Discusses fixed/variable partition schemes, placement algorithms, and fragmentation handling. 2 3

  4. Difference between Internal and External Fragmentation - GeeksforGeeks - Clarifies internal vs external fragmentation and the role of compaction.

Important Limitation

Even when total unused memory is large, a process cannot run in fixed partitioning unless one partition is individually large enough to hold it.2

Footnotes

  1. Memory Management in Operating System - GeeksforGeeks - Summary of partitioned memory allocation and fixed partition characteristics.

  2. Implementation of Contiguous Memory Management Techniques - GeeksforGeeks - Discusses fixed/variable partition schemes, placement algorithms, and fragmentation handling.

Variable Partitioning

Variable partitioning, also called dynamic partitioning, was introduced to reduce the inefficiency of fixed partitions.2 Instead of pre-cutting memory into rigid blocks, the OS maintains free memory and allocates a block sized to the incoming process.2 Because the allocated region more closely matches the process size, internal fragmentation is greatly reduced or eliminated in the ideal model.2

This design improves memory utilization and supports a more flexible number of resident processes, because the number of partitions depends on the current workload rather than a static setup.2 It also avoids the fixed upper bound imposed by a predetermined partition count.

However, variable partitioning introduces more complex bookkeeping and placement decisions. The OS must decide where to place each new process using algorithms such as first fit, best fit, or next fit. Over time, as processes terminate and release memory, small holes form between allocated regions, producing external fragmentation.2

Footnotes

  1. Difference between Fixed Partitioning and Variable Partitioning - GeeksforGeeks - Overview of definitions, features, and comparison. 2 3

  2. Variable (or Dynamic) Partitioning in Operating System - GeeksforGeeks - Explanation of dynamic partitioning and its motivation. 2 3 4

  3. Implementation of Contiguous Memory Management Techniques - GeeksforGeeks - Discusses fixed/variable partition schemes, placement algorithms, and fragmentation handling. 2 3 4

  4. Difference between Internal and External Fragmentation - GeeksforGeeks - Clarifies internal vs external fragmentation and the role of compaction.

PropertyDescription
SetupPartitions are created in advance
WasteMostly internal fragmentation
FlexibilityLow
ComplexityLow
Process limitRestricted by partition count
Typical issueSmall jobs waste space in large partitions2

Footnotes

  1. Memory Management in Operating System - GeeksforGeeks - Summary of partitioned memory allocation and fixed partition characteristics.

  2. Difference between Internal and External Fragmentation - GeeksforGeeks - Clarifies internal vs external fragmentation and the role of compaction.

Conceptual Comparison of Fixed and Variable Partitioning

Higher values indicate stronger presence of the listed property.

How Allocation Differs in Fixed and Variable Partitioning

  1. 1
    Step 1

    In fixed partitioning, the OS creates static regions before execution begins. In variable partitioning, memory initially contains free space that will be split dynamically as requests arrive.3

    Footnotes

    1. Difference between Fixed Partitioning and Variable Partitioning - GeeksforGeeks - Overview of definitions, features, and comparison.

    2. Memory Management in Operating System - GeeksforGeeks - Summary of partitioned memory allocation and fixed partition characteristics.

    3. Variable (or Dynamic) Partitioning in Operating System - GeeksforGeeks - Explanation of dynamic partitioning and its motivation.

  2. 2
    Step 2

    The OS checks the memory requirement of the incoming process and determines whether a suitable contiguous region exists.2

    Footnotes

    1. Variable (or Dynamic) Partitioning in Operating System - GeeksforGeeks - Explanation of dynamic partitioning and its motivation.

    2. Implementation of Contiguous Memory Management Techniques - GeeksforGeeks - Discusses fixed/variable partition schemes, placement algorithms, and fragmentation handling.

  3. 3
    Step 3

    For fixed partitioning, the process is assigned to a partition large enough to hold it. For variable partitioning, the OS applies a placement strategy such as first fit, best fit, or next fit.

    Footnotes

    1. Implementation of Contiguous Memory Management Techniques - GeeksforGeeks - Discusses fixed/variable partition schemes, placement algorithms, and fragmentation handling.

  4. 4
    Step 4

    The process is placed into the chosen contiguous region. In fixed partitioning, leftover space inside the partition becomes internal fragmentation. In variable partitioning, the leftover unallocated memory remains as a separate free hole.3

    Footnotes

    1. Memory Management in Operating System - GeeksforGeeks - Summary of partitioned memory allocation and fixed partition characteristics.

    2. Variable (or Dynamic) Partitioning in Operating System - GeeksforGeeks - Explanation of dynamic partitioning and its motivation.

    3. Difference between Internal and External Fragmentation - GeeksforGeeks - Clarifies internal vs external fragmentation and the role of compaction.

  5. 5
    Step 5

    When the process terminates, its occupied region becomes free. In variable partitioning, repeated allocations and deallocations cause free space to become scattered through memory.2

    Footnotes

    1. Difference between Internal and External Fragmentation - GeeksforGeeks - Clarifies internal vs external fragmentation and the role of compaction.

    2. Implementation of Contiguous Memory Management Techniques - GeeksforGeeks - Discusses fixed/variable partition schemes, placement algorithms, and fragmentation handling.

  6. 6
    Step 6

    If the free space is scattered and cannot satisfy a large contiguous request, the OS may perform compaction to coalesce holes into a single large block.2

    Footnotes

    1. CSC 553 Operating Systems - Lecture 7 - Memory Management - Lecture notes explaining dynamic partitioning, compaction, and relocation cost.

    2. Implementation of Contiguous Memory Management Techniques - GeeksforGeeks - Discusses fixed/variable partition schemes, placement algorithms, and fragmentation handling.

Direct Difference Between Fixed and Variable Partitioning

The two methods differ across design, efficiency, and operational behavior:

CriterionFixed PartitioningVariable Partitioning
Memory divisionDone before executionDone during execution
Partition countFixedVariable
Partition sizeFixed or presetBased on process size
Fragmentation typePrimarily internal fragmentation; some sources also note inefficiencies with unequal partitions2Primarily external fragmentation3
Memory utilizationLower when process sizes vary widelyBetter than fixed partitioning
OS overheadLowerHigher
Process-size limitationCannot exceed largest partitionLimited mainly by available contiguous free memory
Need for compactionRarely centralOften required to counter external fragmentation2

A concise way to remember the distinction is:

Fixed partitioningsimple but wasteful\text{Fixed partitioning} \Rightarrow \text{simple but wasteful} Variable partitioningefficient but fragmentation-prone\text{Variable partitioning} \Rightarrow \text{efficient but fragmentation-prone}

Footnotes

  1. Memory Management in Operating System - GeeksforGeeks - Summary of partitioned memory allocation and fixed partition characteristics.

  2. Memory Management - University lecture notes on fixed partitions, unequal partitions, dynamic partitioning, and compaction.

  3. Difference between Fixed Partitioning and Variable Partitioning - GeeksforGeeks - Overview of definitions, features, and comparison.

  4. Variable (or Dynamic) Partitioning in Operating System - GeeksforGeeks - Explanation of dynamic partitioning and its motivation.

  5. Difference between Internal and External Fragmentation - GeeksforGeeks - Clarifies internal vs external fragmentation and the role of compaction.

  6. CSC 553 Operating Systems - Lecture 7 - Memory Management - Lecture notes explaining dynamic partitioning, compaction, and relocation cost.

  7. Implementation of Contiguous Memory Management Techniques - GeeksforGeeks - Discusses fixed/variable partition schemes, placement algorithms, and fragmentation handling.

Why Compaction Is Needed

Compaction is needed mainly in variable partitioning because free memory becomes fragmented into many small, separate holes after repeated loading and removal of processes.2 Suppose free memory exists as 10 KB+12 KB+18 KB=40 KB10\text{ KB} + 12\text{ KB} + 18\text{ KB} = 40\text{ KB}. A new process needing 30 KB30\text{ KB} still cannot be loaded if no single contiguous hole is at least 30 KB30\text{ KB}. This is the hallmark of external fragmentation.

Compaction solves this by relocating allocated processes so that all free holes are merged into one larger contiguous block.2 After compaction, the same 40 KB40\text{ KB} total free space could become one 40 KB40\text{ KB} hole, allowing the 30 KB30\text{ KB} process to be admitted.2

Compaction therefore has three main purposes:

  1. To overcome external fragmentation.2
  2. To create larger contiguous blocks for incoming processes.2
  3. To improve usable memory availability without physically increasing RAM.

Yet compaction is expensive. The OS must move processes in memory and update their addresses using relocation support.2 This consumes CPU time and can temporarily reduce system performance, so compaction is helpful but not free.2

Footnotes

  1. CSC 553 Operating Systems - Lecture 7 - Memory Management - Lecture notes explaining dynamic partitioning, compaction, and relocation cost. 2 3 4 5 6 7 8

  2. Implementation of Contiguous Memory Management Techniques - GeeksforGeeks - Discusses fixed/variable partition schemes, placement algorithms, and fragmentation handling. 2 3 4 5

  3. Difference between Internal and External Fragmentation - GeeksforGeeks - Clarifies internal vs external fragmentation and the role of compaction. 2 3

Common Conceptual Doubts

Lifecycle of Fragmentation and Compaction in Variable Partitioning

Initial State

Stage 1

Memory contains a large free contiguous region before many processes are loaded."

Footnotes

  1. Variable (or Dynamic) Partitioning in Operating System - GeeksforGeeks - Explanation of dynamic partitioning and its motivation.

Dynamic Allocation

Stage 2

Processes are allocated blocks close to their requested sizes, improving utilization.2"

Footnotes

  1. Variable (or Dynamic) Partitioning in Operating System - GeeksforGeeks - Explanation of dynamic partitioning and its motivation.

  2. Implementation of Contiguous Memory Management Techniques - GeeksforGeeks - Discusses fixed/variable partition schemes, placement algorithms, and fragmentation handling.

Process Exit

Stage 3

Completed processes release memory, leaving holes between active processes.2"

Footnotes

  1. Difference between Internal and External Fragmentation - GeeksforGeeks - Clarifies internal vs external fragmentation and the role of compaction.

  2. Implementation of Contiguous Memory Management Techniques - GeeksforGeeks - Discusses fixed/variable partition schemes, placement algorithms, and fragmentation handling.

External Fragmentation

Stage 4

Total free memory may be adequate, but it is not contiguous enough for a new request."

Footnotes

  1. Difference between Internal and External Fragmentation - GeeksforGeeks - Clarifies internal vs external fragmentation and the role of compaction.

Compaction

Stage 5

The OS shifts processes together, consolidating free space into one larger block.2"

Footnotes

  1. CSC 553 Operating Systems - Lecture 7 - Memory Management - Lecture notes explaining dynamic partitioning, compaction, and relocation cost.

  2. Implementation of Contiguous Memory Management Techniques - GeeksforGeeks - Discusses fixed/variable partition schemes, placement algorithms, and fragmentation handling.

Exam Memory Aid

Associate fixed partitioning with internal fragmentation, and variable partitioning with external fragmentation plus compaction.3

Footnotes

  1. Difference between Fixed Partitioning and Variable Partitioning - GeeksforGeeks - Overview of definitions, features, and comparison.

  2. CSC 553 Operating Systems - Lecture 7 - Memory Management - Lecture notes explaining dynamic partitioning, compaction, and relocation cost.

  3. Difference between Internal and External Fragmentation - GeeksforGeeks - Clarifies internal vs external fragmentation and the role of compaction.

Final Understanding

Fixed partitioning and variable partitioning are both contiguous allocation techniques, but they optimize different goals.2 Fixed partitioning prioritizes simplicity and low overhead, yet wastes memory because partition sizes are rigid. Variable partitioning improves fit and utilization by allocating memory according to process need, but this flexibility creates external fragmentation over time.2

The need for compaction arises because contiguous allocation requires a process to fit into one uninterrupted block of memory.2 When free space is scattered, total memory alone is not enough; its arrangement matters. Compaction restores usability by gathering fragmented free areas into a single contiguous region, although the relocation cost makes it computationally expensive.2

In short:

  • Fixed partitioning \rightarrow simple, static, more internal fragmentation.2
  • Variable partitioning \rightarrow flexible, dynamic, more external fragmentation.2
  • Compaction \rightarrow required to combat external fragmentation by merging free holes.3

Footnotes

  1. Memory Management in Operating System - GeeksforGeeks - Summary of partitioned memory allocation and fixed partition characteristics. 2 3

  2. Variable (or Dynamic) Partitioning in Operating System - GeeksforGeeks - Explanation of dynamic partitioning and its motivation. 2 3

  3. Implementation of Contiguous Memory Management Techniques - GeeksforGeeks - Discusses fixed/variable partition schemes, placement algorithms, and fragmentation handling. 2 3

  4. CSC 553 Operating Systems - Lecture 7 - Memory Management - Lecture notes explaining dynamic partitioning, compaction, and relocation cost. 2 3

  5. Difference between Internal and External Fragmentation - GeeksforGeeks - Clarifies internal vs external fragmentation and the role of compaction. 2

  6. Difference between Fixed Partitioning and Variable Partitioning - GeeksforGeeks - Overview of definitions, features, and comparison. 2

Knowledge Check

Question 1 of 4
Q1Single choice

Which statement best distinguishes fixed partitioning from variable partitioning?

Explore Related Topics

1

Understanding Belady's Anomaly in Operating Systems

Belady's Anomaly shows that, for some page‑replacement policies, adding more physical frames can increase the number of page faults.

  • FIFO (a non‑stack algorithm) does not satisfy the inclusion property and can exhibit the anomaly.
  • On the reference string 1,2,3,4,1,2,5,1,2,3,4,51,2,3,4,1,2,5,1,2,3,4,5, FIFO yields 99 faults with 33 frames but 1010 faults with 44 frames.
  • Stack algorithms such as LRU or Optimal obey M(N,t)M(N+1,t)M(N,t)\subseteq M(N+1,t), guaranteeing that more frames never raise fault counts.
  • Designing a virtual‑memory system with stack‑based replacement eliminates Belady's Anomaly.
2

Purpose of the Modify Bit in a Page Table

The modify (dirty) bit in a page‑table entry signals whether a page in RAM has been altered since it was loaded from its backing store, guiding the OS during page replacement.

  • If the bit is 0 the page is clean and can be discarded; if 1 it is dirty and must be written back before the frame is reused.
  • Hardware (or the MMU) sets the bit automatically on any write to the page.
  • Eviction cost:
    Eviction cost={read replacement page only,modify=0write old page+read replacement page,modify=1\text{Eviction cost}= \begin{cases}\text{read replacement page only}, & \text{modify}=0\\ \text{write old page} + \text{read replacement page}, & \text{modify}=1\end{cases}
  • It works with other status bits (present, accessed) to support efficient replacement policies and avoid unnecessary disk I/O.
3

Memory Fragmentation: Internal vs. External Fragmentation

Memory fragmentation describes how RAM becomes split into unusable pieces, with internal fragmentation wasting space inside fixed‑size partitions and external fragmentation scattering free holes that prevent contiguous allocations.

  • Internal fragmentation per partition: Finternal=SpartitionSprocessF_{internal}=S_{partition}-S_{process}; total waste Ftotal_internal=i=1M(Spartition,iSprocess,i)F_{total\_internal}= \sum_{i=1}^{M}(S_{partition,i}-S_{process,i}).
  • External fragmentation occurs when Sfree=i=1nsiSreqS_{free}= \sum_{i=1}^{n}s_i \ge S_{req} but every hole si<Sreqs_i < S_{req}, leaving a large request unsatisfiable.
  • Compaction merges scattered holes into one block by relocating processes, but incurs high CPU and copying overhead.
  • Paging removes external fragmentation by mapping pages to any frame, yet the last partially filled frame causes bounded internal fragmentation.
  • Knuth’s 50‑percent rule predicts about 0.5N0.5N free holes for NN allocated blocks under first‑fit dynamic partitioning.
Chat with Kiro