gpt4 book ai didi

operating-system - 虚拟内存真的一直有用吗?

转载 作者:行者123 更新时间:2023-12-04 16:29:52 26 4
gpt4 key购买 nike

虚拟内存是现代操作系统当前使用的一个很好的概念。但是我被困在回答一个问题并且对此不太确定。这是问题:

Suppose there are only a few applications running on a machine, such that the physical memory of system is more than the memory required by all the applications. To support virtual memory, the OS needs to do a lot work. So if the running applications all fit in the physical memory, is virtual memory really needed?



(此外,一起运行的应用程序将始终适合 RAM。)

最佳答案

即使所有应用程序的内存使用量都适合物理内存,虚拟内存仍然有用。 VM 可以提供以下功能:

  • 特权内存隔离 (每个应用程序都不能触及内核或内存映射的硬件设备)
  • 进程间内存隔离 (一个应用程序看不到另一个应用程序的内存)
  • 静态内存地址 (例如,每个应用程序在地址 0x0800 0000 处都有 main())
  • 懒人内存 (例如,堆栈中的页面在第一次访问时被分配并设置为零)
  • 重定向内存 (例如 memory-mapped files)
  • 共享程序代码 (如果一个程序或库的多个实例正在运行,它的代码只需要在内存中存储一​​次)
  • 关于operating-system - 虚拟内存真的一直有用吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7713867/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com