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.

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

  1. SharePoint2013 Set a custom application page as site welcome page

    本文主要介绍如何添加一个custom application page as site welcome page 1.首先创建一个sharepoint 2013 empty solution, add ...

  2. 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判断   和  分页 ②修改 ...

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

    Page.ClientScript.RegisterClientScriptBlock 在页面紧跟<form>之后,整个页面未完全加载完成. Page.ClientScript.Regis ...

  4. [转]Repeat Page Header on each Page for reports SSRS

    本文转自:https://stackoverflow.com/questions/3475144/i-want-to-repeat-page-header-on-each-page-for-repor ...

  5. Operating System Memory Management、Page Fault Exception、Cache Replacement Strategy Learning、LRU Algorithm

    目录 . 引言 . 页表 . 结构化内存管理 . 物理内存的管理 . SLAB分配器 . 处理器高速缓存和TLB控制 . 内存管理的概念 . 内存覆盖与内存交换 . 内存连续分配管理方式 . 内存非连 ...

  6. Understanding page frames and pages

    Memory in Linux is organized in the form of pages (typically 4 KB in size). Contiguous linear addres ...

  7. 工作于内存和文件之间的页缓存, Page Cache, the Affair Between Memory and Files

    原文作者:Gustavo Duarte 原文地址:http://duartes.org/gustavo/blog/post/what-your-computer-does-while-you-wait ...

  8. Page Cache, the Affair Between Memory and Files

    Previously we looked at how the kernel manages virtual memory for a user process, but files and I/O ...

  9. 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 tabl ...

  10. Linear to physical address translation with support for page attributes

    Embodiments of the invention are generally directed to systems, methods, and apparatuses for linear ...

随机推荐

  1. C# 显示问题

  2. C# 如何用多个字符串来切分字符串并去除空格

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.D ...

  3. XCode 中的代码块导出与导入

    目标文件放置位置 ~/Library/Developer/Xcode/UserData/CodeSnippets CodeSnippets 这整个文件夹都是 直接搬移整个文件夹 操作方法: 解压缩并复 ...

  4. 解决Delphi图形化界面的TEdit、TLable等组件手动拖拽固定大小,但是编译之后显示有差别的情况

    经常遇到这样的情况,在我们使用Delphi的可视化工具进行UI设计的时候,我们拖拽TEdit或者Label组件,并且在可视化界面上设置它们的长.宽 但是当我们编译和运行程序的时候,却发现真正显示出来的 ...

  5. UWP x:bind

    x:bind 作为win10 新特性,它好在哪?为什么要用它. 最近做UWP,对代码进行重构,对它有了一些了解. 先说优点: 1.性能高,内存小(相比传统的binding) 没图没真相,我先上2张图. ...

  6. Redis学习笔记(4) Redis事务、生存时间及排序

    1. Redis事务 Redis中的事务(transaction)是一组命令的集合,一个事务中的命令要么都执行,要么都不执行.事务的原理是先将属于一个事务的命令发送给Redis,然后再让Redis依次 ...

  7. foreach的用法

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  8. 【CentOS】压缩打包

    一.gzip [-d][-1-9][filename] -d  解压 -[1-9]  压缩等级(默认为6) zcat filename.gz 查看压缩文件 最小化安装centOS是没有安装bzip2的 ...

  9. bzoj4364: [IOI2014]wall砖墙

    线段树打标记的好(luo)题 打打标记,记得下移 = =听说2000000是用来卡线段树的 = =怎么办呢,,, = =打个读入优化看看能不能卡过去吧 #include<cstdio> # ...

  10. type of 操作符和instanceof操作符的区别以及使用方法

    经常见到用typeof和instanceof检测一个变量类型,作为前端小白经常不知道这两者具体的详细用法和区别,今天就整理一下谨记! javaScript中有6中数据类型: 1.Undefinde 2 ...