简体   繁体   English

Best-Fit Memory 管理算法?

[英]Best-Fit Memory Management Algorithm?

I was reading about next-fit algorithm for memory management but could not find an answer to a specific detail.我正在阅读有关 memory 管理的下一个适合算法,但找不到具体细节的答案。

From: https://www.geeksforgeeks.org/program-for-next-fit-algorithm-in-memory-management/来自: https://www.geeksforgeeks.org/program-for-next-fit-algorithm-in-memory-management/

Next fit is a modified version of 'first fit'. Next fit 是“first fit”的修改版本。 It begins as the first fit to find a free partition but when called next time it starts searching from where it left off, not from the beginning.它首先适合找到空闲分区,但下次调用时它会从停止的地方开始搜索,而不是从头开始搜索。

What if no match was found from point x and what comes after (until the last block).如果从点 x 和之后(直到最后一个块)没有找到匹配项怎么办。 will this algorithm continue in cyclic way to search from 0 to x, or it will stuck?该算法会继续以循环方式从 0 搜索到 x,还是会卡住?

(probably the answer will be yes since it makes much more sense but not sure and I really want to know this information). (可能答案是肯定的,因为它更有意义但不确定,我真的很想知道这些信息)。

Yes, this will treat the memory as a cyclical buffer.是的,这会将 memory 视为循环缓冲区。 The search sequence is x->end->begin->x .搜索顺序是x->end->begin->x If you reach your starting point x again, the search failed, so the requested memory isn't available.如果您再次到达起点x ,则搜索失败,因此请求的 memory 不可用。

What you do next depends on earlier details - can you somehow make a larger block available?你接下来做什么取决于早期的细节——你能以某种方式提供更大的块吗? Shuffle memory around?随机播放 memory 左右? In the simple cases (this is a tutorial after all), you just fail.在简单的情况下(毕竟这是一个教程),你就失败了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM