Head-to-head Comparison between the Contiguous and Non-Contiguous Memory Allocation
Contiguous Memory Allocation | Non-Contiguous Memory Allocation |
---|---|
It allocates only a single memory contiguous block to the process. | It separates the process into numerous blocks, each of which is assigned to a different memory address space. |
It is very faster in execution in comparison to non-contiguous memory allocation. | It is slower in execution in comparison to contiguous memory allocation. |
There is no overhead of address translation during execution because the process is stored in contiguous memory space in contiguous memory allocation. | There is an overhead of address translation during process execution because the process blocks are scattered across the memory space. |
In most cases, the operating system keeps a table that lists all available and occupied partitions in the contiguous memory allocation. | In the non-contiguous memory allocation, each process must keep a table that primarily contains each block's base addresses acquired by the memory. |
The Operating System can better control contiguous memory allocation | The Non-Contiguous Memory Allocation is difficult for the Operating System to manage. |
Contiguous memory allocation contains two memory allocations: single partition and multi-partition. | It contains Paging and Segmentation. |
The memory space is partitioned into fixed-sized partitions in the contiguous memory allocation, and each partition is only assigned to one process. | It is broken into several blocks, which are then placed in different areas of the memory based on available memory space. |
Wastage of memory | No wastage of memory |
Swapped-in processes are placed in the initially allotted space in the contiguous memory allocation. | Swapped-in processes in non-contiguous memory allocation can be organized in any location in memory. |
Both internal and exterior fragmentation occurs. | The non-Contiguous memory allocation method causes external fragmentation. |
Key differences between the Contiguous and Non-Contiguous Memory Allocation
- The contiguous memory allocation assigns only one memory contiguous block to the process. In contrast, non-contiguous allocation breaks the process into many blocks and stores them in distinct memory address regions.
- The operating system must preserve a table in contiguous memory allocation that shows which partitions are available and utilized by the process. In contrast, in non-contiguous memory allocation, a table is preserved for each process containing the base address of each process block placed in memory space.
- There is no overhead of address translation during execution because the process is stored in contiguous memory space in contiguous memory allocation. In contrast, in non-contiguous memory allocation, there is an overhead of address translation during process execution since the process blocks are spread across the memory space.
- The Operating System can better control contiguous memory allocation. On the other hand, the Non-Contiguous Memory Allocation is difficult for the Operating System to manage.
- In Contiguous Memory Allocation, the process runs faster as the entire process is in a sequential block. In contrast, the non-contiguous memory allocation execution of the process is slowed down because the process is in multiple positions in the memory.
- Contiguous memory allocation contains two memory allocations: single partition and multi-partition. On the other hand, the Non-Contiguous memory allocation contains Paging and Segmentation.
- Both internal and external fragmentation occurs in the contiguous memory allocation. In contrast, non-contiguous memory allocation causes external fragmentation.
- Swapped-in processes are placed in the initially allotted space in the contiguous memory allocation. In contrast, swapped-in processes in non-contiguous memory allocation can be organized in any location in memory.
1. 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 at 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.
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.
2. 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
Difference between Contiguous and Non-contiguous Memory Allocation :
S.NO. | Contiguous Memory Allocation | Non-Contiguous Memory Allocation |
---|---|---|
1. | 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. |
2. | Faster in Execution. | Slower in Execution. |
3. | It is easier for the OS to control. | It is difficult for the OS to control. |
4. | Overhead is minimum as not much address translations are there while executing a process. | More Overheads are there as there are more address translations. |
5. | Both Internal fragmentation and external fragmentation occurs in Contiguous memory allocation method. | Only External fragmentation occurs in Non-Contiguous memory allocation method. |
6. | It includes single partition allocation and multi-partition allocation. | It includes paging and segmentation. |
7. | Wastage of memory is there. | No memory wastage is there. |
8. | 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. |
9. | It is of two types:
| It is of five types:
|
10. | It could be visualized and implemented using Arrays. | It could be implemented using Linked Lists. |