Difference Between Contiguous and Noncontiguous Memory Allocation in Tabular Form
Comparison Between Contiguous and Noncontiguous Memory Allocation
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.
|Contiguous memory allocation||Noncontiguous memory 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 memory||No wastage of memory.|
Contiguous Memory Allocation
- The simplest allocation scheme is to store each file as a contiguous run of a 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.
- 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.
- 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 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.
- Difference Between Monolithic Kernel and Microkernel
- Difference Between Hard and Soft Real-Time System