dae*_*hee 5 memory paging x86 dirty-data
英特尔架构手册说,当第一次对内存页进行写访问时,CPU 会设置页表条目的脏位。我对这个问题有疑问。
1. The 'dirty bit' in this context is used for guaranteeing the correctness of disk swapping in, out of memory pages. is this correct?
2. Is this automatically performed by the hardware? or is this an implementation of operating system?
3. If it is automatically performed by the hardware, is there any noteworthy difference compared to the usual memory updates which are performed by software instructions?
Run Code Online (Sandbox Code Playgroud)
先感谢您。
小智 5
1本文中的“脏位”用于保证磁盘换入、换出内存页面的正确性。它是否正确?
此硬件部分支持分页。该位帮助操作系统以非常快速且有效的方式确定哪个页面必须转储到磁盘。因为如果内存页面将分页到磁盘并且页面文件中已经分配了空间,如果清除此标志,我们就不能将此页面转储到磁盘。这只是操作系统如何在分页中使用此标志的示例。
2这是由硬件自动执行的吗?或者这是操作系统的实现?
软件清除该标志。硬件设置此标志:
3.7.6 页目录和页表条目
脏 (D) 标志,位 6
指示设置时是否已写入页面。(此标志不用于指向页表的页目录条目。)当页面最初加载到物理内存中时,内存管理软件通常会清除此标志。然后,处理器在第一次访问页面以进行写操作时设置该标志。
。
3如果由硬件自动执行,与通常由软件指令执行的内存更新相比,是否有任何值得注意的差异?
它们具有 LOCK 语义和原子性。