page fault in operating system.(invalid addressing or page not in main memory)
我正在阅读有关需求分页中的页面错误的信息。页面错误发生在
1)被访问的内存是非法的
2)页面有效但不在主存中
我通过有效-无效位读取了它,您可以判断内存是否不符合逻辑
地址空间,因为相应的位会被标记为无效。
相同的有效-无效位用于识别上述2个条件。
我的问题是操作系统如何知道正在访问的内存是否非法
或者如果页面有效但不在主内存中,只有一个有效-无效位?
谢谢!
在按需分页中,如果设置了
无效页面访问导致页面错误陷阱。我们通过以下方式处理它。引用 Silberschatz、Galvin、Gagne 的操作系统原则
We check an internal table(usually kept with the process control block) for this process to determine whether the reference was a valid
or an invalid memory access.If the reference was invalid, we terminate the process. If it was valid, but we have not yet brought in that page, we now page it in. We find a free frame(by taking one from the free frame list, for example). We schedule a disk operation to read the desired page into the newly allocated frame. When the disk read is complete, we modify the internal table kept with the process and the page table to indicate that the page is now
in memory.We restart the instruction that was interrupted by the trap. The process can now access the page as though it had always been in
memory.