I've found the obvious question and also it's bigger brother over at ServerFault.

But my question is quiet different: If Page Faults are the moments in which the OS needs to load something from the SWAP file, why do I get Page Faults even if I've completely deactivated it?

Or did I misunderstand what a Page Fault is?


A little old, but check out this MSDN article.

It describles the two types of page faults.

Hard faults are what you are thinking of - these are where data is not in RAM and has to pulled in from the swap file. They cripple performance (being 10 000's of times slower than RAM access for mechanical hard drives).

Soft faults, however, are triggered by pages that the program requests to be zero (demand zero pages), when a page is written to for the first time (if it was a copy on write page) or if the page is already in memory somewhere else (usually when shared between multiple processes). These are not so bad for performance.

So, you can expect to keep getting soft page faults, even without a page file.

| improve this answer | |
  • Also, some *nix systems do not load entire programs at start. Sections are loaded as needed (via page fault) when a non-resident portion is called. Do not know if Windows also does this, I suspect not from the amount of RAM that apps take on start. – Brian Knoblauch Jan 21 '11 at 14:48
  • 4
    Windows does demand paging of executables and libraries -- it's just that many of them also decide to suck in a ton of other resources at start too. Also, exe compression programs like UPX will break demand paging because now the UPX stub must decompress the entire executable into RAM before the loader can be triggered. – afrazier Jan 21 '11 at 16:23

The point you are missing is that a page fault does not necessarily involve a swap file. You can also memory-map arbitrary files; that is, tell the OS to back a memory region with (a portion of) a given file. That means that when the program accesses a memory page in that region which has not yet been loaded, it is read from the corresponding position in the file; and when a memory page is written (assuming the region is writable), the data is eventually written back to the original file, and not to the swap.

In modern operating systems, this technique is used to load executable code (of executables and libraries), so you should expect read faults to occur even with no swap file.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.