Computer Science Related Others Courses AvailableThe Best Codder.blogspot.com

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 in

 

Head-to-head Comparison between the Contiguous and Non-Contiguous Memory Allocation

Contiguous Memory AllocationNon-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 allocationThe 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 memoryNo 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


Contiguous and Non-Contiguous Memory Allocation in Operating System
  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. Both internal and external fragmentation occurs in the contiguous memory allocation. In contrast, non-contiguous memory allocation causes external fragmentation.
  8. 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 AllocationNon-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:

  1. Fixed(or static) partitioning
  2. Dynamic partitioning

It is of five types:

  1. Paging
  2. Multilevel Paging
  3. Inverted Paging
  4. Segmentation
  5. Segmented Paging
10.It could be visualized and implemented using Arrays.It could be implemented using Linked Lists.

Post a Comment

© Operating System . The Best Codder All rights reserved. Distributed by