Windows Hard Disk Thrashing
As I have mentioned in previous articles as your PC gets older and older and you install more programs and data your PC gets progressively slower and slower. One reason could be because your hard disk is becoming more and more active. This hard disk activity may be in a lot of cases, unnecessary, often being caused by programs and the system causing windows hard disk thrashing. I will show you how to determine where this activity is occurring and what is causing it.
Most people think that hard disk corruption or lack of disk space is the main cause of most system performance problems, but disk time and activity is just as much a performance factor. Disk time is a percentage of time that the hard disk is in use. If the hard disk is running at 80 percent of the time, you can be certain that PC performance being affected.
One other thing to consider is the average disk queue length. This refers to the number of processes that are waiting to use the hard disk. Using the disk time percentage and the disk queue length will tell you how much the hard disk is being used and also if heavy usage is causing a problem. If for example the disk time is running at 40 percent and the average disk queue length is two or less, then your hard disk is keeping up with the requests for access.
If the percentage of disk time is above 80 percent and the average disk queue length is two or more, it means that you PC processes are waiting for the hard disk to become available. If a process has to wait for any component to become available you will experience a drop in performance of your PC.
To determine if you have a windows hard disk thrashing problem, you need to measure the percentage of disk time and the average disk queue length.
Before you start this procedure you should perform a full disk defragmentation on all your hard disk partitions. This will ensure that all the files are contiguous and that the hard disk can perform optimum reads and writes of the files.
After you have performed the defragmentation run the Performance Monitor utility by going to
Start > Control Panel > Administrative Tools and then Performance.
When the Performance Monitor opens there may be some monitor counters already running, (shown at bottom right), click on each in turn and then delete to remove them. As each counter uses some resources it is best to have as few running as possible to make the measurements more accurate.
In the Performance Monitor window perform the following:
- Click the + icon to open the Add Counters box.
- Click on the Performance Object dropdown list and select PhysicalDisk. This will bring up a list of physical disk counters.
- Select the %Disk Time counter from the list and click the All Instances button. This will ensure the system will measure the performance of all the hard drives.
- Click the Add button to add the counter to the Monitor.
- Select Avg. Disk Queue Length from the counter list, and again the All Instances button. Click the Add button then the Close button. The performance monitor will then begin analyzing the disk usage, as shown below.
Looking at the monitor results, you can see that the lines shown on the graph correspond to the counters that you have selected. In the example above, the pink line is predominant. The pink line is the average disk queue length for the drives C: and D: which are in this case partitions on hard drive Zero. A more accurate value can be obtained by selecting the counter that you want to see in more detail.
So how do you track down the process that is using all the disk resources? The first thing you need to do is bring up the Windows Task Manager. You can do this by pressing -
on your keyboard holding each down in turn. The Windows task manager shows you the utilization of resources that all the processes running in the system use.
Windows task manager usually has some monitor counters selected as standard but disk usage may not be one of the them. You can select which counter you want to see as follows:
- Click on the “Processes” tab at the top. This will show a list of processes that are running on your PC.
- Click on “View” in the menu at the top then on the “Select Columns”.
- In the window that comes up deselect everything then select “I/O Read bytes” and “I/O Write Bytes” then “OK”
You should now only see these counters as show below.
You should now look to see if any of the counters against the processes are changing at a rapid rate. The counters should only change occasionally or not at all. If you see one that is constantly changing, then that the process may be the one that is hogging your PC’s disk resources.
To kill a process that is hogging a resource, right click on the process and then select “End Process” in the menu that appears.
If the particular process is a part of the Windows XP operating system, there’s a good chance that the high disk usage is caused by thrashing. High disk usage can be caused by “swapping and thrashing”
When the system moves memory blocks between physical and virtual memory (normally called Paging) this is swapping. This is a normal process in Windows XP. Virtual memory is space used on hard disk and as extra memory. This is done when another process requires “Real” memory and there is not enough empty space in real memory to place it. In this case the system will put a process that is in real memory down to the paging file on disk to create the space.
Windows hard disk thrashing is caused by high real physical and virtual memory swapping. This is one reason why it is recommended that as much real memory be installed on your PC as possible.
However, if the disk usage is traced to a non-Windows process, then you may have problems with an individual service/program.
If you eliminate a process you feel is causing excessive disk usage, processor time and memory will also be affected.
You can now see how you can track and identify a program or process that may be causing excessive disk time usage and how it degrades the system. Using the Performance Monitor to measure both disk time and average queue length, you can see if the hard disk is being excessively used by the system’s processes. Using the Widows Task Manager you can further determine which process that may be causing the problem.
There is an optimizer that helps in this regard. It is called “The Perfect Optimizer” which not only cleans the windows registry but also does other tasks in cleaning up your hard disk. Go to “The Perfect Optimizer” to review it