Difference Between Contiguous and NonContiguous Memory Allocation (original) (raw)

Last Updated : 12 Jul, 2025

Memory management is one of the fundamentals of operating systems that has implications for its performances and use of resources. These are discussed below: Contiguous and non-contiguous allocation of memory Allocation of memory may take either of the following forms: This article enables you to know the difference between the two, how memory is allocated in the two cases, and the most appropriate situations for using each of the methods.

**What is Contiguous Memory Allocation?

Contiguous memory allocation is basically a method in which a single contiguous section/part of memory is allocated to a process or file needing it. Because of this, all the available memory space resides in the same place together, which means that the freely/unused available memory partitions are not distributed in a random fashion here and there across the whole memory space.

Contiguos Memory Allocation

The main memory is a combination of two main portions- one for the operating system and other for the user program. We can implement/achieve contiguous memory allocation by dividing the memory partitions into fixed size partitions.

Advantages of Contiguous Memory Allocation

Disadvantages of Contiguous Memory Allocation

**What is Non-Contiguous Memory Allocation?

Non-Contiguous memory allocation is basically a method on the contrary to contiguous allocation method, allocates the memory space present in different locations to the process as per it's requirements. As all the available memory space is in a distributed pattern so the freely available memory space is also scattered here and there. This technique of memory allocation helps to reduce the wastage of memory, which eventually gives rise to Internal and external fragmentation.

Non-Contiguos Memory Allocation

Advantages of Non-Contiguous Memory Allocation

Disadvantages of Non-Contiguous Memory Allocation

**Difference Between Contiguous and Non-contiguous Memory Allocation

Contiguous Memory Allocation Non-Contiguous Memory Allocation
Contiguous memory allocation allocates consecutive blocks of memory to a file/process. Non-Contiguous memory allocation allocates separate blocks of memory to a file/process.
Faster in Execution. Slower in Execution.
It is easier for the OS to control. It is difficult for the OS to control.
Overhead is minimum as not much address translations are there while executing a process. More Overheads are there as there are more address translations.
Both Internal fragmentation and external fragmentation occurs in Contiguous memory allocation method. Only External fragmentation occurs in Non-Contiguous memory allocation method.
It includes single partition allocation and multi-partition allocation. It includes paging and segmentation.
Wastage of memory is there. No memory wastage is there.
In contiguous memory allocation, swapped-in processes are arranged in the originally allocated space. In non-contiguous memory allocation, swapped-in processes can be arranged in any place in the memory.
It is of two types:Fixed(or static) partitioningDynamic partitioning It is of five types:PagingMultilevel PagingInverted PagingSegmentationSegmented Paging
It could be visualized and implemented using Arrays. It could be implemented using Linked Lists.
Degree of multiprogramming is fixed as fixed partitions Degree of multiprogramming is not fixed

Conclusion

With respect to memory management, whether it is contiguous memory allocation or non-contiguous memory, it has its advantages and disadvantages. Despite the extent that contiguous memory allocation is easier to control and it executes faster than linked allocation, it experiences a problem of fragmentation and wastage of memory.

In contrast, non-contiguous memory allocation employs more memory space but is less efficient when, in terms of execution time, they are slower and are quite complex to manage. I have listed down the advantages and disadvantages of each of the two methods to help you understand the circumstances under which you should apply a particular method for your system.