小页面错误究竟是如何导致 identified/resolved 的?
How exactly do minor page faults get identified/resolved?
我非常清楚分段错误和主要页面错误会发生什么,但我对次要页面错误的微妙之处更好奇,也许动态链接库就是一个例子。 Wikipedia 表示,例如:
If the page is loaded in memory at the time the fault is generated, but is not marked in the memory management unit as being loaded in memory, then it is called a minor or soft page fault. The page fault handler in the operating system merely needs to make the entry for that page in the memory management unit point to the page in memory and indicate that the page is loaded in memory; it does not need to read the page into memory. This could happen if the memory is shared by different programs and the page is already brought into memory for other programs.
"The page fault handler in the operating system merely needs to make the entry for that page in the memory management unit point to the page in memory" 这条线让我很困惑。每个进程都有自己的页面 table。因此,如果我尝试映射,比如说,libc
,内核通过什么过程来确定它已经被映射了?它如何知道另一个进程正在使用它或已经有一个与之关联的框架?页面缓存会发生这种情况吗?我读了一些关于它的文章 here,但我认为对内核中发生的识别和解决次要页面错误的步骤进行一些澄清会很有帮助。
编辑:它looks 像基数树一样用于跟踪?虽然我不太确定我是否理解正确。
一开始,内核不知道页面是否在内存中。据推测,该进程确实有一个打开文件的句柄,因此内核通过内核端文件描述符条目执行操作。这涉及调用文件系统,当然,它知道文件的哪些页面驻留在内存中,因为它是加载页面所需的代码。
我非常清楚分段错误和主要页面错误会发生什么,但我对次要页面错误的微妙之处更好奇,也许动态链接库就是一个例子。 Wikipedia 表示,例如:
If the page is loaded in memory at the time the fault is generated, but is not marked in the memory management unit as being loaded in memory, then it is called a minor or soft page fault. The page fault handler in the operating system merely needs to make the entry for that page in the memory management unit point to the page in memory and indicate that the page is loaded in memory; it does not need to read the page into memory. This could happen if the memory is shared by different programs and the page is already brought into memory for other programs.
"The page fault handler in the operating system merely needs to make the entry for that page in the memory management unit point to the page in memory" 这条线让我很困惑。每个进程都有自己的页面 table。因此,如果我尝试映射,比如说,libc
,内核通过什么过程来确定它已经被映射了?它如何知道另一个进程正在使用它或已经有一个与之关联的框架?页面缓存会发生这种情况吗?我读了一些关于它的文章 here,但我认为对内核中发生的识别和解决次要页面错误的步骤进行一些澄清会很有帮助。
编辑:它looks 像基数树一样用于跟踪?虽然我不太确定我是否理解正确。
一开始,内核不知道页面是否在内存中。据推测,该进程确实有一个打开文件的句柄,因此内核通过内核端文件描述符条目执行操作。这涉及调用文件系统,当然,它知道文件的哪些页面驻留在内存中,因为它是加载页面所需的代码。