What is Contiguous Memory Allocation?
It is the type of memory allocation method. When a process requests the memory, a single contiguous section of memory blocks is allotted depending on its requirements.
It is completed by partitioning the memory into fixed-sized partitions and assigning every partition to a single process. However, it will limit the degree of multiprogramming to the number of fixed partitions done in memory.
Advantages and Disadvantages of Contiguous Memory Allocation
There are various advantages and disadvantages of contiguous memory allocation. Some of the advantages and disadvantages are as follows:
Advantages
- It is simple to keep track of how many memory blocks are left, which determines how many more processes can be granted memory space.
- The read performance of contiguous memory allocation is good because the complete file may be read from the disk in a single task.
- The contiguous allocation is simple to set up and performs well.
Disadvantages
- Fragmentation isn't a problem because every new file may be written to the end of the disk after the previous one.
- When generating a new file, it must know its eventual size to select the appropriate hole size.
- When the disk is filled up, it would be necessary to compress or reuse the spare space in the holes.
What is Non-Contiguous Memory Allocation?
It allows a process to obtain multiple memory blocks in various locations in memory based on its requirements. The non-contiguous memory allocation also reduces memory wastage caused by internal and external fragmentation because it uses the memory holes created by internal and external fragmentation.
The two methods for making a process's physical address space non-contiguous are paging and segmentation. Non-contiguous memory allocation divides the process into blocks (pages or segments) that are allocated to different areas of memory space based on memory availability.
Non-contiguous memory allocation can decrease memory wastage, but it also raises address translation overheads. As the process portions are stored in separate locations in memory, the memory execution is slowed because time is consumed in address translation.
Advantages and Disadvantages of Non-Contiguous Memory Allocation
There are various advantages and disadvantages of non-contiguous memory allocation. Some of the advantages and disadvantages are as follows:
Advantages
- It has the advantage of reducing memory waste, but it increases overhead because of the address translation.
- It slows down the memory execution because time is consumed in address translation.
Disadvantages
- The downside of this memory allocation is that the access is slow because you must reach the other nodes using pointers and traverse them.