操作系统如何知道缺少页面的磁盘地址? [英] How does the OS know disk address of an absent page?

查看:415
本文介绍了操作系统如何知道缺少页面的磁盘地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

分页充当虚拟地址空间和物理地址空间之间的间接层. 给定地址后,操作系统(OS)/内存管理单元(MMU)会将其转换为主内存位置.

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.

我的问题是:

在主内存中没有页面的情况下

In the scenario that the page is absent in primary memory

  1. 操作系统如何知道在磁盘上找到页面的位置?
  2. 它在哪里存储1的信息?(它不存储在页表条目中).链接到代码示例会很棒!

推荐答案

您可以找到该过程的详细说明

You can find the detailed explanation of the process here

  1. 操作系统如何知道在磁盘上找到页面的位置?

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

它在哪里存储1的信息(不存储在页表条目中).链接到代码示例会很棒!

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

内核需要知道的所有内容实际上都存储在PTE中(它存储了swap_info的索引和swap_map中的偏移量).

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,因此使用第一个索引内核便知道要查找的区域.现在,每个区域都有一个swap_map,它是一个数组,每个元素都是一页.使用存储在PTE中的偏移量,它可以访问特定页面.

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.

这篇关于操作系统如何知道缺少页面的磁盘地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆