Difference Between Contiguous and Noncontiguous Memory Allocation

Difference Between Contiguous and Noncontiguous Memory Allocation in Tabular Form

The basic difference between Contiguous and Noncontiguous memory allocation is that the Contiguous Memory Allocation allocates the consecutive blocks of memory to a process. and the Noncontiguous Memory Allocation allocates the separate memory blocks at a different location.


Comparison Chart

Contiguous allocationNoncontiguous allocation
Program execution takes place without the overhead.Address translation is overhead.
Swapped-in processes are placed in the original area.Swapped-in processes can be placed anywhere in memory.
Suffer from internal fragmentation.only paging suffers from internal fragmentation.
Allocates a single area of memory for the process.Allocates more than one block of memory for the process.
Wastage of memoryNo wastage of memory.




Contiguous Allocation

  • The simplest allocation scheme is to store each file as a contiguous run of disk block.
  • We see an example of contiguous storage allocation in Image
  • Here the first 40 disk blocks are shown, starting with block 0 on the Initially, the disk was empty.
contiguous Memory Allocation
Contiguous Memory Allocation

Advantages

  • First, it is simple to implement because keeping track of where a file’s blocks are is reduced to remembering two numbers: The disk address of the first block and the number of blocks in the file.
  • Second, the read performance is excellent because the entire file can be read from the disk in a single operation. Only one seek is needed (to the first block), so data comes in at the full bandwidth of the disk.
  • Thus, the contiguous allocation is simple to implement and has high performance.

Disadvantages

  • Over the course of time, the disk becomes fragmented.
  • Initially, fragmentation is not a problem, since each new file can be written at the end of the disk, following the previous one.
  • However, eventually the disk will fill up and it will become necessary to either compact the disk, which is expensive or to reuse the free space in the holes.
  • Reusing the space requires maintaining a list of a hole.
  • However, when a new file is to be created, it is necessary to know its final size in order to choose a hole of the correct size to place it in.

Related Differences:

  1. Difference Between Monolithic Kernel and Microkernel
  2. Difference Between Hard and Soft Real-Time System



LEAVE A REPLY

Please enter your comment!
Please enter your name here