Contiguous Memory Allocation Systems
Partitioning Schemes
Carving Out Space
When an operating system needs to run a program, it creates a process. That process needs a place to live in the computer's physical memory, or RAM. The OS acts as a landlord, deciding how to divide up the available memory and assign portions to each tenant process. This fundamental task is called memory partitioning.
The simplest approach, common in early computing, is Single-Partition Allocation. In this model, memory is split into just two sections. One is reserved for the operating system, and the other is given to a single user process. When you wanted to run a different program, you had to stop the current one, and the OS would load the new one into that same single partition.
This method is straightforward but incredibly inefficient. The CPU sits idle while waiting for I/O operations, and only one task can run at a time. To make better use of the hardware, operating systems evolved to handle multiple processes concurrently.
Juggling Multiple Processes
To run more than one process, the OS needs to divide the user space in memory into multiple sections. This is called Multi-Partition Allocation. By loading several processes into memory at once, the OS can switch the CPU's attention between them, drastically improving utilisation. The number of processes that can reside in memory at one time is known as the .
There are two main ways to approach multi-partitioning: fixed and dynamic.
In Fixed Partitioning, the memory is divided into a set number of partitions of specific sizes when the system boots. These partitions are static and don't change while the computer is running.
When a process arrives, the OS looks for a partition large enough to hold it. This is simple to manage, but leads to a problem called internal fragmentation. If a 20 KB process is placed in a 32 KB partition, the 12 KB of leftover space inside the partition is wasted. It can't be assigned to any other process, because the entire partition is considered 'in use'.
The alternative is Dynamic Partitioning. Instead of pre-defining the partitions, memory is treated as one large, open block. When a process needs space, the OS carves out a chunk of memory exactly the size required. When the process terminates, that chunk is freed and can be merged with adjacent free blocks.
Dynamic Partitioning allocates memory on demand, creating partitions that are tailor-made for each process.
This solves the internal fragmentation problem because partitions are the exact size needed. However, it introduces a new issue: . Over time, as processes of various sizes are loaded and unloaded, the free memory can become broken into many small, non-contiguous pieces. You might have 100 KB of total free memory, but if it's scattered in ten 10 KB chunks, you can't run a process that needs 12 KB.
| Feature | Fixed Partitioning | Dynamic Partitioning |
|---|---|---|
| Partition Size | Static, defined at boot | Variable, created on demand |
| Pros | Simple to implement | No internal fragmentation |
| Cons | Internal fragmentation | External fragmentation, more complex |
| Best For | Simple, predictable systems | General-purpose operating systems |
These early partitioning schemes laid the groundwork for modern memory management. While simple, they highlight the fundamental trade-offs between simplicity, efficiency, and resource waste that more advanced techniques like paging and segmentation aim to solve.
What is the primary drawback of the Single-Partition Allocation method for memory management?
An operating system uses fixed-size memory partitions of 64 KB. If a process requiring 40 KB of memory is loaded into one of these partitions, what is the resulting issue called?
