Difference between Contiguous and Non-Contiguous Memory Allocation
In this tutorial, we will be covering the differences between Contiguous and NonContiguous Memory Allocation.
In the Operating System, there are two techniques for memory allocation and these are as follows:
Contiguous Memory Allocation
In Contiguous Memory Allocation whenever any user process request for the memory then a single section of the contiguous memory block is allocated to that process according to the requirements of the process. Contiguous memory allocation is achieved just by dividing the memory into the fixed-sized partition.
In this, all the available memory space remains together at one place and freely available memory partitions are not distributed here and there across the whole memory space.
Non-Contiguous Memory Allocation
With the help of Non-contiguous memory allocation, a process is allowed to acquire several memory blocks at different locations in the memory according to its need. In the non-contiguous memory allocation, the available free memory space is distributed here and there which means that all the free memory space is not in one place.
In this technique, memory space acquired by a process is not at one place but it is at different locations according to the requirements of the process.
Now it's time to take a look at the differences between Contiguous and Non-Contiguous Memory Allocation.
|Contiguous Memory Allocation
||Non-Contiguous Memory Allocation
|The contiguous Memory Allocation technique allocates one single contiguous block of memory to the process and memory is allocated to the process in a continuous fashion.
||The non-Contiguous Memory allocation technique divides the process into several blocks and then places them in the different address space of the memory that is memory is allocated to the process in a non-contiguous fashion.
|In this Allocation scheme, there is no overhead in the address translation while the execution of the process.
||While in this scheme, there is overhead in the address translation while the execution of the process.
|In Contiguous Memory Allocation, the process executes faster because the whole process is in a sequential block.
||In Non-contiguous Memory allocation execution of the process is slow as the process is in different locations of the memory.
|Contiguous Memory Allocation is easier for the Operating System to control.
||The non-Contiguous Memory Allocation scheme is difficult for the Operating System to control.
|In this, the memory space is divided into fixed-sized partitions and each partition is allocated only to a single process.
||In this scheme, the process is divided into several blocks and then these blocks are placed in different parts of the memory according to the availability of memory space.
|Contiguous memory allocation includes single partition allocation and multi-partition allocation.
||Non-Contiguous memory allocation includes Paging and Segmentation.
|In this type of memory allocation, generally, a table is maintained by the operating system that maintains the list of all available and occupied partitions in the memory space.
||In this type of memory allocation generally, a table has to be maintained for each process that mainly carries the base addresses of each block that has been acquired by a process in the memory.
|There is wastage of memory in Contiguous Memory allocation.
||There is no wastage of memory in Non-Contiguous Memory allocation.
In this type of allocation,swapped-in processes are arranged in the originally allocated space.
|In this type of allocation,swapped-in processes can be arranged in any place in the memory.