如果每个页框在磁盘中都有一个副本?

If every page frame has a copy in the disk?

如果每个页框在辅助存储中都有一个副本,什么时候制作这个副本并记录映射。

当 MMU 遇到空页条目时会发生什么。如果当时有空闲的物理页面,为什么还要在某些时候(之前或现在)制作副本。

为什么不能忽略它,只在需要换出页框时才创建这个副本?为每个页框保留副本会不会太昂贵(而且不是懒惰),尤其是在物理内存越来越多的今天?

一个网站说虚拟页面最初都在磁盘上 https://computationstructures.org/lectures/vm/vm.html#7

由于没有其他相关的质量检查所以完全消除了我的困惑。我在阅读在线电子书“了解 Linux® 虚拟内存管理器”后找到了答案。

书中处理页面错误的图。

答案是。

if every page frame has a copy in the secondary storage, and when is the time to make this copy and record the mapping?

不,内核仅在没有剩余可用页面时才换出页框,这可能在调用 alloc_page 时发生(可能在第一次访问空 PTE 时发生,或访问一个页面已换出的 PTE)。

在函数 alloc_page 中,非自由页面框架可能会被换出以进行此需求调用的 space。

What would happen when MMU meets an empty page entry. If there are free physical pages at the time, why bother to make a copy at some points(before or now).

do_no_page 会被调用,其中 alloc_page 在大多数情况下会被调用。