How does the OS know disk address of an absent page?

落花浮王杯 提交于 2020-01-14 10:37:30

问题


Paging acts as indirection layer between virtual address space and physical address space. Given an address, the Operating System(OS)/Memory Management Unit(MMU) translates it to a primary memory location.

My questions are:

In the scenario that the page is absent in primary memory

  1. How does the OS know where to find the page on disk?
  2. Where does it store information for 1?(It is not stored in the page table entry). Links to code examples would be great!

回答1:


You can find the detailed explanation of the process here

  1. How does the OS know where to find the page on disk?

  2. Where does it store information for 1?(It is not stored in the page table entry). Links to code examples would be great!

Everything kernel needs to know is actually stored in PTE (it stores index to swap_info and offset within the swap_map).

swap_info_struct is there for every swap area (file or the partition), so using the first index kernel knows in what area to look. Now every area has a swap_map which is an array with elements that are one page each. Using offset stored in PTE, it can access the particular page.



来源:https://stackoverflow.com/questions/32846456/how-does-the-os-know-disk-address-of-an-absent-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!