Page in/Page out/Page fault

Paging refers to writing portions, termed pages, of a process‘ memory to disk.

Swapping, strictly speaking, refers to writing the entire process, not just part, to disk. In Linux, true swapping is exceedingly rare, but the terms paging and swapping often are used interchangeably.

When pages are written to disk, the event is called a page-out, and when pages are returned to physical memory, the event is called a page-in.

A page fault occurs when the kernel needs a page, finds it doesn‘t exist in physical memory because it has been paged-out, and re-reads it in from disk.

Page-ins are common, normal and are not a cause for concern. For example, when an application first starts up, its executable image and data are paged-in. This is normal behavior.

Page-outs, however, can be a sign of trouble. When the kernel detects that memory is running low, it attempts to free up memory by paging out.

Though this may happen briefly from time to time, if page-outs are plentiful and constant, the kernel can reach a point where it‘s actually spending more time managing paging activity than running the applications,

and system performance suffers. This woeful state is referred to as thrashing.

The reaction to a "page fault" is a "page in".

Page faults occur when any application (and not just the kernel) needs a page that is not currently in memory. A page fault is also not a "kernel" thing, it‘s a hardware thing. The reaction to the fault, often a "page in" is handled by the kernel. Also, the setup required to support virtual memory is handled by the kernel, but the fault itself is all hardware.

There is also a slight inaccuracy in stating that the fault occurs because the page was previously paged out. The page that causes the fault does not have to have been previously paged out. If the page referred to program code it doesn‘t get paged out, it just gets paged in when the fault occurs since the code exists in the executable file and doesn‘t need to be paged out. A page fault can also occur when trying to access memory beyond the end of the stack, thus signalling the O/S that more stack space needs to be allocated, but this again is memory that was never paged out. Here the page is just used as a guard or sentry to tell the O/S when the application needs more stack space.

So I would reword that sentence thusly:

A page fault occurs when the CPU needs a page which does not exist in physical memory. In response to the fault the kernel allocates a free page for the missing memory and if the page was previously paged out, the kernel pages in the previously paged out data. If the kernel is unable to find an unused page to allocate for the missing memory then an existing page will be freed and if need be paged out.

时间: 2024-10-05 21:44:49

Page in/Page out/Page fault的相关文章

2016/05/17 thinkphp3.2.2 分页的使用:①在Home下设置Publics文件夹或在thinkPHP下library的vender 把page.class.php 考贝进入 ②通过new 实例化方式调用 $page=new \Home\Publics\Page($total,3);

注意分页的方法有两种:一种是thinkphp3.2 自带的   另一种是之前新闻页用过的     显示效果稍有差别 显示效果: 细节问题: ①搜索页面  要加session判断   和  分页 ②修改和添加页面需要有session判断 ③增删改的权限设置 控制器端: 1 <?php 2 namespace Home\Controller; 3 use Think\Controller; 4 class UserController extends Controller 5 { 6 public

Response.Write 与 Page.ClientScript.RegisterStartupScript 与 Page.ClientScript.RegisterClientScriptBlock 之间的区别

Response.Write 与   Page.ClientScript.RegisterStartupScript 与 Page.ClientScript.RegisterClientScriptBlock 之间的区别 方法1,使用Response.Write,这种方法会把JS代码写在页面的最顶部(<html>的前面):System.Web.HttpContext.Current.Response.Write("<script language=javascript>a

Framework7学习笔记之Page的定义与Page初始化

一:Page 一个page文件定义了一个app页面,它可以定义该页面的导航栏.底部工具栏.中间详细内容等等.  page通过加载到view容器中运行,而view在index.html中定义. index.html定义了app的基本结构:引入样式文件.引入js文件.创建app标签.创建view标签. 因此,page的定义文件 XX.html 不需要在定义head.body等等部分,只需要使用 div 搭建出页面的 状态栏.侧边栏.页面内容(导航栏.主体部分.底部工具栏).(不是每部分都要有,按需搭

Page.ClientScript.RegisterStartupScript 与 Page.ClientScript.RegisterClientScriptBlock 之间的区别

Page.ClientScript.RegisterClientScriptBlock 在页面紧跟<form>之后,整个页面未完全加载完成. Page.ClientScript.RegisterStartupScript 在页面</form>之前,页面基本空间等加载完成之后. 举个例子,页面加载时需要给页面 文本框 赋默认值. 用Page.ClientScript.RegisterStartupScript OK,是没问题的. 但是用Page.ClientScript.Regist

&lt;jsp:directive.page import=&quot;&quot;/&gt; 和 &lt;jsp:page import=&quot;&quot;/&gt; 的区别

如果只在同一个页面中使用的话 <%@ page import="com.weixing.dao" %> 相当于 <%@ directive.page import="com.weixing.dao" %> 这两个方法的区别在于作用域的不同.使用的场景不同. <%@ page import="com.weixing.dao"%> 这个方法的作用域比较广,可用于多个页面内使用. <%@ directive.p

Understanding page frames and pages

Memory in Linux is organized in the form of pages (typically 4 KB in size). Contiguous linear addresses within a page are mapped onto contiguous physical addresses on the RAM chip. However contiguous pages can be present anywhere on the physical RAM.

Linear to physical address translation with support for page attributes

Embodiments of the invention are generally directed to systems, methods, and apparatuses for linear to physical address translation with support for?page attributes. In some embodiments, a system receives an instruction to translate a memory pointer

System and method to prioritize large memory page allocation in virtualized systems

The prioritization of large memory page mapping is a function of the access bits in the L1 page table. In a first phase of operation, the number of set access bits in each of the L1 page tables is counted periodically and a current count value is cal

PHP---分页类(page.class.php)

1 <?php 2 class Page 3 { 4 private $total; //数据总记录数 5 private $listRows; //每页显示的行数 6 private $limit; //偏移量长度 7 private $url; 8 private $pageNum; //总页数 9 private $config=array('header'=>'个记录','prev'=>'上一页','next'=>'下一页','first'=>'首页','last'=

JSP的学习(3)——语法知识二之page指令

本篇接上一篇<JSP的学习(2)——语法知识一>,继续来学习JSP的语法.本文主要从JSP指令中的page指令,对其各个属性进行详细的学习: JSP指令: JSP指令是为JSP引擎而设计的,JSP指令不产生任何可见输出,只是告诉在转换成Servlet的过程中如何处理JSP页面中的其余部分.在JSP 2.0 规范中共定义了三个指令: 1)   page指令 2)   include指令 3)   taglib指令 taglib指令是导入标签库的指令,以后会介绍到. JSP指令格式: <%@