交换空间上的缓存有什么意义?

发布于 2024-07-08 10:52:34 字数 77 浏览 8 评论 0原文

难道不是在主内存中缓存东西以避免昂贵的磁盘 I/O 吗?

如果您在硬盘驱动器的交换空间中缓存内容,如何避免磁盘 I/O?

Isn't the point of caching things in main memory to avoid the expensive disk i/o?

If you're caching things in the swap space of a hard drive, how does that avoid disk i/o?

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

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

发布评论

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

评论(1

飘落散花 2024-07-15 10:52:34

一般来说,缓存使用的内存不会被换出。
它将被标记为正在使用。

编辑 - 是的,虚拟内存是复制到磁盘的内存块,因为 RAM 已满。 为了使用它,您必须将其复制回内存(这很慢)。
缓存将最近使用的文件的副本保留在内存中,因为这比返回到磁盘更快。 这里存在一个冲突 - 用于缓存的 RAM 越多,则必须换出到磁盘的其他内存就越多(假设您没有剩余内存)。
这不一定是坏事,您的计算机上运行的许多东西只是偶尔运行,因此将它们推送到磁盘以为照片的缓存副本腾出空间可能是有意义的。

Generally the memory used by the cache wouldn't get swapped out.
It would be marked as in-use.

edit - Yes virtual memory is memory blocks copied to disk because the RAM is full. In order to use it you have to copy it back into memory (which is slow).
Cache is keeping copies of recently used files in memory because this is quicker than going back to disk for them. There is a conflict here - the more RAM you use for cache, the more other memory you have to swap out to disk, assuming you have none free left.
This isn't necessarily bad, there are lots of things running on your computer that only run occaisonally and so pushing them out to disk to make space for cached copies of your photos might make sense.

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