📜  连续和非连续内存分配之间的区别

📅  最后修改于: 2021-09-15 01:14:12             🧑  作者: Mango

1. 连续内存分配:
连续内存分配基本上是一种将单个连续内存段/部分分配给需要它的进程或文件的方法。因此,所有可用内存空间都驻留在同一个地方,这意味着自由/未使用的可用内存分区不会以随机方式分布在整个内存空间中。

主存储器是两个主要部分的组合——一个用于操作系统,另一个用于用户程序。我们可以通过将内存分区划分为固定大小的分区来实现/实现连续的内存分配。

2. 非连续内存分配:
非连续内存分配基本上是一种与连续分配方法相反的方法,根据进程的要求将不同位置的内存空间分配给进程。由于所有可用的内存空间都是分布式模式,因此免费可用的内存空间也分散在各处。
这种内存分配技术有助于减少内存的浪费,这最终会导致内部和外部碎片化。

连续和非连续内存分配的区别:

S.NO. Contiguous Memory Allocation Non-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. 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.