Page in/page Out/page Fault

Source: Internet
Author: User

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 was exceedingly rare, but the terms paging and swapping often are used interchangeably.

When pages were written to disk, the event was called a page-out, and when pages were 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 had been paged-out, and re-reads it in from disk.

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

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

Though This could happen briefly from time to time, if page-outs is plentiful and constant, the kernel can reach a point wh ere it ' s actually spending more time managing paging activity than running the applications,

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

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

page Faults occur when no application (and not just the kernel) needs a page, 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 are handled by the kernel, but the fault itself are all hardware.

There is also a slight inaccuracy in stating so the fault occurs because the page was previously paged out. The page that causes the fault does does not have a 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 is paged out. A page fault can also occur when trying to access memory beyond the end of the stack, thus signalling the O/S it more St ACK space needs to being allocated, but this again is the memory that were never paged out. Here the page was 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 isn't exist in physical memory. In response to the fault the kernel allocates a free page for the missing memory and if the page is previously paged out, The kernel pages in the previously paged out data. If The kernel is unable to find a unused page to allocate for the missing memory then an existing page would be freed and If need is paged out.

Page in/page Out/page Fault

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.