gpt4 book ai didi

linux-kernel - 小页面错误到底是如何识别/解决的?

转载 作者:行者123 更新时间:2023-12-05 06:22:03 25 4
gpt4 key购买 nike

我非常清楚段错误和主要页面错误会发生什么,但我对次要页面错误的微妙之处更加好奇,也许动态链接库就是一个例子。 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.

“操作系统中的页面错误处理程序只需要使内存管理单元中该页面的条目指向内存中的页面”这一行让我感到困惑。每个进程都有自己的页表。因此,如果我尝试映射,比方说,libc,内核通过什么过程来确定它已经被映射?它如何知道另一个进程正在使用它或已经有一个与之关联的框架?页面缓存会发生这种情况吗?我正在读一些关于它的文章 here ,但我认为对内核中发生的用于识别和解决次要页面错误的步骤进行一些澄清会很有帮助。

编辑:它looks就像基数树用来跟踪?虽然我不太确定我是否理解正确。

最佳答案

起初,内核并不知道页面是否在内存中。据推测,该进程确实有一个打开文件的句柄,因此内核通过内核端文件描述符条目执行操作。这涉及调用文件系统,当然,它知道文件的哪些页面驻留在内存中,因为它是加载页面所需的代码。

关于linux-kernel - 小页面错误到底是如何识别/解决的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59441828/

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