操作系统内部碎片和外部碎片_操作系统中的碎片

操作系统内部碎片和外部碎片

In a computer storage system, as processes are loaded and removed from memory, the free memory space is broken into small pieces. In this way memory space used inefficiently, so the capacity or performance of the system may degrade.

在计算机存储系统中,随着进程从内存中加载和删除,可用内存空间被分解成小块。 这样,内存空间使用效率不高,因此系统的容量或性能可能会下降。

The conditions of the fragmentation depend on the system of memory allocation. In most of the cases, memory space is wasted.

碎片的条件取决于内存分配系统。 在大多数情况下,内存空间被浪费了。

Sometimes it happens that memory blocks cannot be allocated to processes due to their small size and memory blocks remain unused. This problem is known as Fragmentation.

有时,由于内存块较小,无法将内存块分配给进程,并且内存块仍未使用。 这个问题被称为碎片

碎裂的原因 (Cause of fragmentation)

User processes are loaded and removed from the main memory, processes are stored in the blocks of main memory. At the time of process loading and swapping there are many spaces left which are not capable to load any other process due to their size.

用户进程从主存储器中加载和删除,进程存储在主存储器的块中。 在加载和交换进程时,由于空间大小,剩余许多空间无法加载任何其他进程。

Due to the dynamical allocation of main memory processes, main memory is available but its space is not sufficient to load any other process.

由于主内存进程的动态分配,因此可以使用主内存,但是其空间不足以加载任何其他进程。

碎片类型 (Types of fragmentation)

  1. External fragmentation

    外部碎片

  2. Internal fragmentation

    内部碎片

  3. Data fragmentation

    数据碎片

1) External fragmentation

1)外部碎片

External fragmentation exists when adequate total memory space exists to satisfy a request, but it is not contiguous; storage is fragmented into a large number of holes.

当存在足够的总内存空间来满足请求时, 外部碎片就存在了,但是它不是连续的。 存储分散成大量的Kong。

2) Internal fragmentation

2)内部碎片

An approach is to allocate very small holes as part of the larger request. Thus the allocated memory may be larger than the requested memory.

一种方法是在较大的请求中分配很小的Kong。 因此,分配的内存可能大于请求的内存。

The difference between these two numbers is internal fragmentation - the memory that is internal to any partition but is not being used.

这两个数字之间的区别是内部碎片 -任何分区内部但未被使用的内存。

操作系统内部碎片和外部碎片_操作系统中的碎片_第1张图片

There is a hole of 500k. Suppose that next process request 450k. If we allocate the requested block, so there is a hole left which is 50k. This type of condition raises internal fragmentation.

有一个500k的Kong。 假设下一个处理请求为450k。 如果我们分配请求的块,那么剩下的Kong就是50k。 这种情况会引起内部分裂

3) Data fragmentation

3)数据碎片

This type of fragmentation occurs when a group of data in memory is broken up into many pieces that are not contiguous that is not close together.

当内存中的一组数据分解为不连续且彼此不紧密的许多碎片时,会发生这种类型的碎片

If we are attempting to insert a large object into memory that has already suffered then external fragmentation occurs.

如果我们试图将一个大对象插入已经遭受的内存中,则会发生外部碎片

Example:

例:

In a file system files are arranged in units called clustersblocks. There is a free space to store files in these blocks in a contiguous manner.

在文件系统中,文件以称为clustersblocks的单位排列。 有可用空间以连续方式在这些块中存储文件。

In this way, we can do a rapid sequential file reads and writes. As files are added, deleted, and modified or changed in size, there are external fragmentation occurs, and there are only small holes in which we can place new data.

这样,我们可以进行快速的顺序文件读取和写入。 随着文件大小的增加,删除,修改或更改,会发生外部碎片 ,并且只有小Kong可以放置新数据。

when a current file is enlarged, the operating system places the new data a in new non-contiguous data blocks to fit into the available holes. New data blocks don't need to be contiguous. This process slowing access cause of seek time and rotational latency of the read/write head and incurring additional overhead to organize additional locations. This is file system fragmentation.

当当前文件被放大时,操作系统会将新数据a放置在新的非连续数据块中以适合可用的空位。 新的数据块不必是连续的。 此过程减慢了寻道时间和读/写头旋转等待时间的访问原因,并导致组织其他位置的额外开销。 这是文件系统碎片

翻译自: https://www.includehelp.com/operating-systems/fragmentation.aspx

操作系统内部碎片和外部碎片

你可能感兴趣的:(java,linux,python,操作系统,大数据)