What are Hard Faults per Second?

Written by:  • Edited by: J. F. Amprimoz
Updated May 31, 2011
• Related Guides: Swap File | Windows | Hard Drive

Are high CPU and hard drive utilization slowing your Windows PC to a crawl? You've started up "Resource Monitor" and are surprised at the number of "hard faults/sec" ticking by. Is this the bottleneck? What are hard faults per second anyway, and how many of them is too many?

Sluggish PC performance may have led you to start the Windows Resource Monitor from Task Manager or the Reliability and Performance Monitor from Administrative Tools in Control Panel. There, you observed a high utilization rate in both the CPU and the hard drive, and a section labeled "Memory" is showing dozens (or maybe) hundreds of hard faults per second. What are hard faults? Are they responsible for your PC's slow performance? How many of them are too many, and what can you do about it?

Hard Fault vs. Page Fault

First of all, a "hard fault" was previously called a "page fault" in earlier versions of Windows. Perhaps page faults were more easily understood from the name, too. A hard fault happens when the address in memory of part of a program is no longer in main memory, but has been instead swapped out to the paging file, making the system go looking for it on the hard disk. When this happens a lot, it causes slowdowns and increased hard disk activity. When it happens an awful lot, the possibility of hard disk thrashing arises. That's when a program stops responding, but the hard drive continues to run for an extended period. This has historically been referred to as "getting into the page file."

In this era of relatively large memory, with most PCs having a gigabyte of main memory or more, hard drive thrashing and the problem of getting into the page or swapping file has become rare. However, it's not impossible for a Vista computer with limited resources (too many programs running at a time) to be making a program read data continually to and from the hard disk. Each time this happens, it's a hard fault. A high number per second suggests that something is running very slowly.

Memory Management in Vista

Let's look more closely at how memory management in Vista works. When an application runs, it does not use all of its allocated memory at the same time. Some of the memory pages age. Some of them are modified before they are swapped. The memory manager keeps up with which were modified, which were just swapped because they are unused, and where they are in memory or in the swap file. The objective is to keep memory turning over in order to minimize (much slower) hard drive activity. Thus, using the swap file is just part of normal operations in Vista.

But what if performance really is lousy and the entire system is bogged down? Is it time to worry about too many hard faults? Maybe. A high number of hard faults, accompanied by high disk activity, suggests that one or more programs you're running would benefit from having more RAM installed. You could also try moving your swap file (pagefile.sys) to another internal hard drive (not to another partition on the same hard drive). This may provide a benefit in that Windows can access the page file more quickly if it is not fighting a program trying to continuously read data from the same hard drive.

Also make sure that your page file is large enough. A size a little larger than installed RAM works very well. (Too small a page file can definitely cause a lot of page faults.)

Managing the Page File - Manual or Automatic?

In Vista or Windows 7, to check the page file size, press the Windows button on the keyboard or click the Start orb and type in "system." In the search results at the top, click the item that simply says "System." This is a shortcut to Start → Control Panel → System. Click "Advanced System Settings" and then click the "Advanced" tab. In the "Performance" area, click on "Settings." In the resulting dialog, you should see your page file size under "Virtual memory."

In Windows XP, right-click "My Computer" and select "Properties." Then click "Advanced" and follow the same steps as in Vista.

Should you let Windows "automatically manage the paging file size for all drives?" There are pros and cons involved. An advantage of Windows handling it is that you won't run out of page file unless you run out of hard drive space. A disadvantage is that a variable file, unlike a fixed-size file, may become fragmented and cause even more hard drive activity. Of course, if Windows runs out of swap space in a fixed-sized file, it may promptly crash.

On my PC, I have three internal hard drives. One is a (faster) one TB drive, and another is a 500 GB drive that Windows runs from. I decided that I didn't want a swap file on the C: drive at all, but I didn't mind Windows handling the swap file automatically on the other drive. So I unselected "Automatically manage paging file size for all drives" and then clicked the C: drive. Then I clicked "No paging file" and "Set." I did the same for the second hard drive. Finally, I clicked the one TB drive I planned to use, clicked "System managed file size" and "Set."

For that drive, "Virtual Memory" is showing as Recommended: 4411 MB and Currently Allocated: 3241 MB. (The PC has 3 GB of RAM.)

If you prefer to manually manage your swap file size, try making it about 15% larger than your amount of RAM.

More on the Name Change

So adding more memory and moving or enlarging the swap file are positive steps that can be taken when there are too many hard faults per second. Seeing if there's an update for the program causing the bottleneck may help, too.

But let's look at the implication of Microsoft's changing the name from "page fault" to "hard fault.”

There are actually three locations that items in memory can be in. One is in memory. One is on the hard drive in the swap file, and the third is in the "memory cache." The cache is basically a small pool of the most recently used "pages." These get to hang around in RAM for a while. If unused, they are moved out to disk. When a program requests the content of a certain item from memory, if it's in main RAM, the program gets it very quickly. If it is in the cache, because it's a memory-to-memory transfer, the program still gets it quickly. This is called a "soft page fault." The thing to bear in mind is that this transfer is very fast- much faster than reading the content from the hard drive- so it can be considered a benign part of the operation of a paged memory system. However, if the needed page is no longer in the cache, Windows goes hunting it in the swap file, and this is a "hard fault" or "hard page fault."

Microsoft doesn't want us to worry our pretty little heads about the soft stuff, so they don't tell us about it anymore.


Comments

Showing all 12 comments
 
Seth Jan 9, 2012 2:50 AM
RE: What are Hard Faults per Second?
I have 8GB of RAM in a Windows 7 laptop and my computer would slow to a crawl when using Adobe production suite. It had hard faults and was showing 99% ram usage even though the task manager showed only a couple GB's used. The resource monitor on the other hand showed that the windows search services were using 6GB of RAM. I turned off the service and now it's blazing fast again. Probably deleting the index and disabling that would work too. Hope this helps with some memory problems.
Lamar Stonecypher Nov 23, 2011 6:07 AM
RE: What are Hard Faults per Second?
Hi, Christian -  I'm not sure that you CAN turn off the page file completely. I found a reference in "Windows Internals" fifth edition on p. 781. "If no paging files are specified, the system virtual memory commit limit is based on available memory. If the minimum and maximum paging file sizes are both zero, this indicates a system managed paging file, which causes the system to choose the page file size..."
Christian Ravera Nov 16, 2011 1:52 PM
RE: What are Hard Faults per Second?
If hard faults are only to secondary storage, why is it that they still happen even after you turn off paging completely?<br>
Zachary Taylor Nov 2, 2011 5:34 AM
RE: What are Hard Faults per Second?
Ditto. That information would be really useful.
Zachary Taylor Nov 2, 2011 5:33 AM
RE: What are Hard Faults per Second?
Could you please state an approximate number? I'm trying to determine whether current problems with my PC are memory-related or not, and I've noticed what (seems to be) a high number of hard faults-- but I'm not sure if it means anything. It keeps crashing even when I have small numbers of windows open, and I've noticed it spike up to near the top of the graph (100 per second) sometimes, but I'm not sure whether that's important. I have 8 gigs of memory so it's not a question of whether I should add more, but whether there's a hardware problem.
michael.ha11 Oct 19, 2011 4:00 AM
RE: What are Hard Faults per Second?
So if I have got a performance problem and am looking to solve it, what number of Hard Faults/min should start making me concerned. 1 maybe, or 10, or 100, or 1000 - can you give at least some order of magnitude?
Jacob Mar 24, 2011 3:54 PM
The answer is simple
42
tomm174 Feb 28, 2011 10:14 AM
Which lamebrain at MS
How could anyone not have noticed that describing page faults as 'hard faults' was seriously misleading.
They aren't 'hard' they are immediately remedied when the page is loaded. They are an entirely software phenomenon.
On seeing the display my immediate assumption was that I was going to need to restart this machine & run memtest86.
I am continually amazed by how Microsoft Corporation with all it's vast resources makes braindead decisions over and over again
Crazy Nov 22, 2010 2:07 PM
Great explanation
Thanks for the great explanation. I was looking in resource monitor on vista thinking why is this computer running slow sometimes then realized my cpu usage would skyrocket now and then for a very short period of time and the hard drive seemed to be very active all the time. Then I noticed hard faults and wondered exactly what it referred to. I saw this page under google and it explained it all. Thanks!
Robert Trebor Aug 23, 2010 11:48 PM
Re: Page Faults
So an anti virus program that continually accesses new files would effectively create faults?
Lamar Stonecypher Dec 1, 2009 11:45 PM
RE: What are Hard Faults per Second?
Hi, Erik,

Thanks for the comment. I very deliberately did not try to state a number because the number itself is not important. What is too many is when the hard faults begin to affect the machine performance. Adobe Flash CS3, for example, throws a lot of hard faults on my PC, but I'm able to continue working in it. If you are not having performance issues, please don't worry about the hard faults. They are a normal part of Windows memory management.
Erik Dec 1, 2009 4:21 AM
RE: What are Hard Faults per Second?
You start with: What are hard faults per second anyway, and how many of them is too many?

But I still don't know how many is too many...
 
blog comments powered by Disqus
Email to a friend