Explanation of Page Faults

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.
LVL 58
tigermattAsked:
Who is Participating?
 
-DJL-Commented:
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.  

0
 
sysreq2000Commented:
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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.