内部和外部碎片

发布于 2024-07-29 00:46:52 字数 1825 浏览 5 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

若水般的淡然安静女子 2024-08-05 00:46:52

外部碎片
总内存空间足以满足请求或在其中驻留进程,但它不是连续的,因此无法使用。

外部碎片

内部碎片
分配给进程的内存块更大。 内存的某些部分未被使用,因为它不能被其他进程使用。

内部碎片

External fragmentation
Total memory space is enough to satisfy a request or to reside a process in it, but it is not contiguous so it can not be used.

External fragmentation

Internal fragmentation
Memory block assigned to process is bigger. Some portion of memory is left unused as it can not be used by another process.

Internal fragmentation

半城柳色半声笛 2024-08-05 00:46:52

首先,术语碎片暗示存在一个被分成多个部分的实体——碎片。

  • 内部碎片:典型的纸质书是页面的集合(文本分为页面)。 当一章的结尾不在页面的末尾并且新的章节从新的页面开始时,这些章节之间存在间隙,这是空间的浪费 - 一个块(一本书的页面)内部有未使用的空间 /em> (内部) —“空白”

  • 外部碎片:假设你有一本纸质日记,但你没有一页一页地按顺序写下你的想法,但是,相当随机。 你可能会遇到这样的情况:你想连续写 3 页,但你不能,因为没有 3 页一页一页的干净页,你的日记中可能总共有 15 页干净页,但是它们不连续

First of all the term fragmentation cues there's an entity divided into parts — fragments.

  • Internal fragmentation: Typical paper book is a collection of pages (text divided into pages). When a chapter's end isn't located at the end of page and new chapter starts from new page, there's a gap between those chapters and it's a waste of space — a chunk (page for a book) has unused space inside (internally) — "white space"

  • External fragmentation: Say you have a paper diary and you didn't write your thoughts sequentially page after page, but, rather randomly. You might end up with a situation when you'd want to write 3 pages in row, but you can't since there're no 3 clean pages one-by-one, you might have 15 clean pages in the diary totally, but they're not contiguous

〆凄凉。 2024-08-05 00:46:52

我是一个只在 10mb 分区中分配内存的操作系统。

内部碎片

  • 你要求 17mb 内存,
  • 我给你 20mb 内存

满足此请求只会导致 3mb 内部碎片。

外部碎片

  • 你要求 20MB 内存
  • 我给你 20MB 内存
  • 我给你的 20MB 内存紧邻另一块已分配的现有内存。 在向您提供这段内存时,我将一个未分配的空间“拆分”为两个空间。

满足这个请求刚刚导致了外部碎片

I am an operating system that only allocates you memory in 10mb partitions.

Internal Fragmentation

  • You ask for 17mb of memory
  • I give you 20mb of memory

Fulfilling this request has just led to 3mb of internal fragmentation.

External Fragmentation

  • You ask for 20mb of memory
  • I give you 20mb of memory
  • The 20mb of memory that I give you is not immediately contiguous next to another existing piece of allocated memory. In so handing you this memory, I have "split" a single unallocated space into two spaces.

Fulfilling this request has just led to external fragmentation

全部不再 2024-08-05 00:46:52

大概来自此网站

内部碎片 当内存发生内部碎片时
分配器在内存块内留下额外的空间
已分配给客户。 这通常发生是因为
处理器的设计规定内存必须被分割成块
某些尺寸——例如,可能需要均匀地放置块
除以 4、8 或 16 个字节。 发生这种情况时,客户端
例如,需要 57 字节的内存,可以分配一个块
包含60个字节,甚至64个。客户端没有的额外字节
需要浪费,随着时间的推移,这些未使用的内存小块会
建立并创建大量无法放入的内存
由分配器使用。 因为所有这些无用的字节都在里面
较大的内存块,碎片被认为是内部的。

外部碎片 当外部碎片发生时
内存分配器在之间留下未使用的内存块的部分
分配的内存的部分。 例如,如果有多个内存块
分配在连续的一行中,但中间的块之一
行被释放(可能是因为使用该块的进程
的内存停止运行),空闲块被碎片化。 该块是
如果需要的话,分配器稍后仍然可以使用
适合该块的内存,但该块现在无法使用
需要更大的内存。 它不能与总免费量合并在一起
系统可用的内存,因为总内存必须是连续的
它可用于更大的任务。 这样,整个部分
空闲内存最终可能会与整体隔离,而这通常也是如此
小而大量使用,从而总体上减少了免费
随着时间的推移,可能会导致密钥可用内存不足
任务。

Presumably from this site:

Internal Fragmentation Internal fragmentation occurs when the memory
allocator leaves extra space empty inside of a block of memory that
has been allocated for a client. This usually happens because the
processor’s design stipulates that memory must be cut into blocks of
certain sizes -- for example, blocks may be required to be evenly be
divided by four, eight or 16 bytes. When this occurs, a client that
needs 57 bytes of memory, for example, may be allocated a block that
contains 60 bytes, or even 64. The extra bytes that the client doesn’t
need go to waste, and over time these tiny chunks of unused memory can
build up and create large quantities of memory that can’t be put to
use by the allocator. Because all of these useless bytes are inside
larger memory blocks, the fragmentation is considered internal.

External Fragmentation External fragmentation happens when the
memory allocator leaves sections of unused memory blocks between
portions of allocated memory. For example, if several memory blocks
are allocated in a continuous line but one of the middle blocks in the
line is freed (perhaps because the process that was using that block
of memory stopped running), the free block is fragmented. The block is
still available for use by the allocator later if there’s a need for
memory that fits in that block, but the block is now unusable for
larger memory needs. It cannot be lumped back in with the total free
memory available to the system, as total memory must be contiguous for
it to be useable for larger tasks. In this way, entire sections of
free memory can end up isolated from the whole that are often too
small for significant use, which creates an overall reduction of free
memory that over time can lead to a lack of available memory for key
tasks.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文