estadisticas web Skip to content

Difference between contiguous and noncontiguous memory allocation

Difference between contiguous and noncontiguous memory allocation

Memory a wide range of bytes, in which each byte has its own address. Memory allocation can be classified into two methods: contiguous memory allocation and noncontiguous memory allocation. The main difference between contiguous and noncontiguous memory allocation that the contiguous memory allocation assigns consecutive blocks of memory to a process that requires memory while the non-contiguous memory allocation assigns separate memory blocks to the different location in memory space non-consecutively to a process that requires memory. We will discuss some more differences between contiguous and noncontiguous memory allocation with the help of the comparison table shown below.

Comparative chart

Basis for comparison Allocation of contiguous memory Allocation of non-contiguous memory
Basic Assign consecutive blocks of memory to a process. Assign separate blocks of memory to a process.
Overheads Contiguous memory allocation does not have the overhead of address translation when executing a process. Noncontiguous memory allocation has an overhead in address translation when executing a process.
Execution rate A process fades to a contiguous memory assignment A process runs relatively slower in terms of non-contiguous memory allocation.
Solution The storage space must be divided into a fixed-size partition and each partition is allocated to only one process. Divide the process into several blocks and place them in different parts of memory based on the availability of available memory space.
table A table is managed by the operating system which maintains the list of available and occupied partitions in the memory space A table must be maintained for each process that carries the base addresses of each block that has been acquired by a process in memory.

Definition of contiguous memory allocation

The operating system and user processes must both be contained in the main memory. So the main memory divided into two partitions: in one partition resides the operating system and in other user processes reside. Under normal conditions, different user processes must reside in memory at the same time, and therefore it is important to consider allocating memory to processes.

The memory allocation adjoins one of the memory allocation methods. In contiguous memory allocation, when a process requires memory, one single contiguous section of memory blocks it is assigned to the process according to its needs.

The contiguous memory allocation can be obtained by dividing the memory into the partition of fixed size and allocate each partition to a single process. But this will cause the degree of multiprogramming, limiting the number of fixed partitions made in memory. The contiguous memory allocation also leads to internal fragmentation . For example, if a fixed-size memory block assigned to a process slightly larger than its requirement, the memory space left in the block called internal fragmentation. When the process residing in the partition ends, the partition becomes available for another process.

In the variable partitioning scheme, the operating system maintains one table which indicates which partition of free memory and which one occupied by processes. The contiguous memory allocation connects the execution of a process reducing the overhead costs of address translation.

Definition of non-contiguous memory allocation

Noncontiguous memory allocation allows a process to acquire the various blocks of memory in the different position in the memory in according to your needs. The memory allocation is not contiguous decreases also it waste of memory caused due to internal and external fragmentation. Since it uses memory holes, created during internal and external fragmentation.

Paging and segmentation are the two ways in which the physical addressing space of a non-contiguous process. In noncontiguous memory allocation, the process divided into blocks (pages or segments) which are placed in the different area of ​​the memory space according to the availability of the memory.

Noncontiguous memory allocation has the advantage of reducing memory waste, but increases the overhead costs of address translation. Since the parts of the process are placed in a different position in memory, slows down execution memory because time is consumed in address translation.

Here, the operating system must maintain the table for each process which contains the base address of each block that is acquired by the process in the memory space.

Key differences between contiguous and noncontiguous memory allocation

  1. The fundamental difference between contiguous and noncontiguous memory allocation that contiguous allocation allocates a single contiguous block of memory to the process while the noncontiguous allocation divides the process in several blocks and places them in the different memory address space, that is in a non-contiguous way.
  2. In contiguous memory allocation, the process stored in a contiguous memory space; therefore not there is address translation overhead during execution. But in the allocation of non-contiguous memory, vi an overhead of address translation during the execution of the process, because the process blocks are distributed in the memory space.
  3. The process stored in the contiguous memory is executed faster compared to the process stored in non-contiguous memory space.
  4. The solution for contiguous memory allocation is to divide the storage space into the fixed-size partition and allocate a partition to a single process. On the other hand, in non-contiguous memory allocation, a process divided into several blocks and each block placed in different points of memory in based on memory availability.
  5. In contiguous memory allocation, the operating system must maintain one table indicating which partition available for the process and which occupied by the process. When allocating noncontiguous memory, one is kept table for every process which indicates the base address of each process block placed in memory space.

Conclusion:

The contiguous memory allocation does not create any overload and connects the execution speed of the process but increases the waste of memory . In turn, the allocation of noncontiguous memory creates overloads of address translation, reduces the speed of execution of a process but increases memory usage . So there are pros and cons of both allocation methods.