3

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?

Bobby
  • 9,032

2 Answers2

8

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.

LaC
  • 3,019
5

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.

Glorfindel
  • 4,158
DMA57361
  • 18,793