NonContiguous Allocation in Operating System (original) (raw)

Non-Contiguous Allocation in Operating System

Last Updated : 15 Apr, 2026

Non-contiguous allocation, also known as dynamic or linked allocation, is a technique used in operating systems to allocate memory to processes that do not require a contiguous block of memory. Here a process is divided into parts and stored in different free blocks of main memory, not necessarily consecutive:

**Note: These non-contiguous blocks of memory can be located anywhere in the physical memory.

Approaches for Non-Contiguous Memory Allocation

Non-contiguous allocation involves the use of pointers to link the non-contiguous memory blocks allocated to a process. These pointers are used to keep track of the memory blocks allocated to the process and to locate them during the execution of the process.

There are two fundamental approaches to implement non-contiguous memory allocation:

Non-Contiguous-Allocation

Non-Contiguous Allocation

It has the advantage of reducing memory wastage but it increases the overheads due to address translation, which results in slow execution.

**Note: Paging avoids external fragmentation but may suffer from internal fragmentation.

Working of Non-Contiguous Memory Allocation

A process is divided into parts that can be stored in different free spaces of main memory (not necessarily consecutive).

**Example: If a process

P = 4KB

and memory has two free slots of

2KB

each, contiguous allocation fails (no spanning allowed). In non-contiguous allocation,

P

is split into two

2KB

parts, each fitting into the free slots.

**In contiguous allocation:

**In Non-Contiguous allocation:

**The below diagram will explain in a better way:

paging2

How Non Contiguous Allocation work

In what manner we divide a process to allocate them into main memory? The process is divided after analyzing the number of empty spaces and their size in the main memory. But, it has some challenge:

Dividing processes dynamically based on changing free space is time-consuming as their sizes changing every time due to execution of already present processes in main memory.

In order to avoid this time-consuming process, we divide our process in secondary memory in advance before reaching the main memory for its execution. Every process is divided into various parts of equal size called Pages. We also divide our main memory into different parts of equal size called Frames. It is important to understand that:

Rule: pageSize = frameSize.

**Example with Paging: If frame size = 2KB, processes P1 and P2 (2 pages each) can be stored alternately across free frames in memory.

Non_contiguous_allocation_3

Page Mapping with Frames

Resolvent main memory, In main memory the sequence of storage of pages are: First page of P1 -> First page of P2 -> Second page of P1 -> Second page of P2

os_3

Pages Distribution

**Note: Non-contiguous allocation (via paging) divides processes into pages and memory into frames, ensuring flexible and efficient use of memory without requiring consecutive space.

Pros of Non-Contiguous Allocation

Cons of Non-Contiguous Allocation