Explanation of Page Faults

Posted on 2009-02-21
Last Modified: 2013-11-10
Can somebody who understands the concept please provide me with an explanation of what a Page Fault is?

I have specifically been told that an application with a high number of page faults is not a bad thing, but what does having a high level actually mean?

Please, no links if you can avoid it. I'd rather even just a few sentences to describe this rather than pages of articles to read.
Question by:tigermatt
    LVL 11

    Assisted Solution

    The operating system will regularly "flush out" parts of ram and save it on the hard disk in order to free up ram for use. Usually it's data in ram that the OS has identified as not being accessed often that get flushed out to the hard disk. The data is stored in a "page file" or "swap file" on the hard disk.

    When a program needs that data, the operating system loads it back into memory for the program to access. The program requesting a "page" of data in ram that isn't there is known as a page fault. It's a misleading label bacause it's not really a "fault" per se, it's supposed to happen that way by design.

    That's not the only scenario by it's by far the most common. In a nutshell, a page fault is a program's attempt to access data in RAM that is not there or is not accessible.
    LVL 6

    Accepted Solution

    A page is a fixed size block of memory that can be moved between memory and the page file on the hard disk.  x86 Windows uses 4KB pages.  When the OS needs to make space in physical memory, pages that are not likely to be required in the near future are moved to disk.

    A page fault occurs when the page an application is requesting is not available in memory.  

    There are two types of page fault;

    Hard Page Fault - the requested page isn't available in main memory and must be loaded from disk.  These are the most costly performance wise - could be anywhere between 10,000 to 100,000 times slower than if the page had been available.

    Soft Page Fault - the requested page isn't currently available to the application, but the page exists in memory.  Soft faults are much faster than hard faults as no disk access is required, all the viriutal memory manager has to do is update page tables to allow the program access to the requested page.  This usually occurs when pages are shared between programs.

    Pages faults are never really good, but are a common and necessary event.  When looking at 'Page Fault' figures in windows you need to be aware if the figure includes both soft and hard faults or just one or the other.  Its also important to look at how the page faults are impacting the system, rather than just worrying about the number.

    Take the vmware-hostd service.  That always seems to have high numbers of page faults listed in task manager.  Now, the task manager page faults is the sum of both hard and soft faults, however digging deeper, most of the faults are soft.  Presumably the service is sharing some memory with the running VMs in order to manage them. In this case high page faults isn't something to worry about.

    If on the other hand you are getting lots of hard page faults and this is causing high disk utilisation then you have a problem - thrashing is the term used to describe the situation where a computer spends all its time swapping pages in and out of memory instead of running the applications.  


    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Does your iMac really need a hardware upgrade? Will upgrading RAM speed-up your computer? If yes, then how can you proceed? Upgrading RAM in your iMac is not as simple as it may seem. This article will help you in getting and installing right RA…
    Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
    In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now