Finding bottlenecks
For the past 2 weeks I've been experiencing a very annoying problem with my computer - it became painfully slow.
- Alt+tabbing between windows, or minimizing a window would 'choke' the audio player;
- It took ages to go into hibernate, it would take longer to get out of hibernate;
- If you moved the mouse continuously, you would see that at times it would stop for a few moments before getting back to normal.
Using the computer is a royal pain in the ass, you can't do normal multi-tasking stuff because everything is slow. Moreover, you'd hear the system's cooler (it's a laptop) turn on and rotate at its maximum - thus generating a lot of noise and heat. I also noticed a dramatic decrease in the lifetime of my battery.
I have to confess, I didn't enjoy using the machine... Here's how I managed to find the cause of the issue and fix the problem.
Troubleshooting approaches:
- Using the task manager to see which process takes all that CPU time hasn't revealed any abnormal patterns;
- A network traffic monitor (TCPview is a nice tool) hasn't revealed any suspicious connections;
- No unknown system services were found;
- No unknown processes were running;
- Inspecting all the registry startup sections had no effect either;
All my traditional methods were inefficient. At that point I could say that my system is as clean as it could possibly be. There were no redundant processes, no useless services, all the bells and whistles were turned off. I then started uninstalling old software I haven't used for a while (though ~5 GB of free space on the system disk should be enough). I checked the settings of the paging file - everything was fine. In other words, I have manually checked every corner of my system, including the most obscure ones - and nothing was looking suspicious.
Analyzing the facts
There were several clues that had a significant role in my research.
- My recent adventure with the smart card service (eventually it turned out it had nothing to do with it);
- The problem started to occur after I hot-plugged in the DVD-CDRW combo drive to burn a CD;
- Hibernating and waking up was very slow;
- chkdsk and defrag were incredibly slow, and one could see in task manager that CPU use was permanently at 100%;
The last two details made it clear that the bottleneck is in the input/output operations. There were no processes causing the slow-downs, allowing me to exclude the possibility that the slow-downs were caused by spyware or viruses (that's a pretty brave assumption, especially that I do not use any antivirus or antispyware :-)
What I did next - examine the info provided by the device manager, perhaps it was a driver issue? Nope, it wasn't... Still, checking out the device manager was a good idea, because I noticed that my IDE controller was working in PIO mode, instead of DMA.
PIO stands for 'programmed input/output', while DMA means 'direct memory access'. Now, things started to become clear - any data transfer involved the CPU, thus it was parmanently loaded during defragmentation, or when check-disk was running (in contrast, when DMA is used, the transfers happen without involving the CPU). The funny thing is that the setting was "use DMA if available", while the setting in effect was "PIO mode". Weird, does that mean that my system doesn't support DMA? Give me a break!
I've downloaded a new chipset driver from Intel's site, updated, restarted - same thing - the system was still hell-slow. The good news was that PIO was still the effective setting, meaning that my assumption was right. From this point, it was clear that it had something to do with PIO vs DMA. Unfortunately, I haven't checked that setting in the past, meaning that it was impossible for me to figure put whether PIO was actually the 'right' setting; and I have disabled System Restore - so I couldn't go back to a previous state and check it out.
The first idea was to check out HP's site (after all, they're the ones who manufactured the nc6230 I have, and it is still under warranty). The idea was to ask somebody from the company whether having the controller operate in PIO mode was a normal thing, and if not - how to get it back to DMA (since the update from Intel didn't help). The plan was nice, but it never came into life because one cannot email a support technician without registering on the site. Perhaps this was still possible, but the info was burried too deep, and I didn't feel like digging (lazyness is a bad thing, I know).
Ok, let me fast-forward to the solution -
- I knew I had to get it into DMA, or die trying;
- The driver info made it known that the driver vendor was Microsoft, not Intel (which explained why the chipset driver update didn't change anything);
- Since the vendor is Microsoft, it means that Windows will find the right driver;
- I decided to rename %Windir%\inf to something else (so that it wouldn't automatically find the same 'faulty driver'). However, this was not possible because Windows protects the Inf folder from being deleted or renamed (which is reasonable);
- That wasn't bad news, maybe it would find the driver again and set the default settings for the hardware (which would hopefully mean that DMA is used);
- I opened the device manager, and simply uninstalled the hard disk, and the IDE controller;
After the restart, Windows told me that new hardware was found, that drivers were installed and a restart is needed. Before restarting, I checked the settings, PIO was gone, and so were the slow-downs.
My system is now back to normal, I managed to get over this problem without reinstalling Windows, hahaha!
It beats me how hot-plugging a CD writer could have such an impact, but the facts make it clear to me that this was the action that caused the consequences I 'enjoyed' for almost two weeks. But look at the bright side - I have removed ALL the useless stuff that was taking space and resources while I was 'digging', so now my system is slighly faster than it used to be before the 'accident', since I turned off everything that can be turned off without affecting the system's functionality.
This reminds me of an old story - a dying father told his sons that a treasure was hidden in the garden. After he died, they started digging, and found no treasure; however - all the excavation activities had a positive effect on the plants that were growing there, so they had a lot of crops that year. The moral of the story - happy digging! ;-)
Here is a picture that captures the moment of revelation:
2 comments
Comment from: virusok Visitor
Comment from: Acvilon (known as Chuck) Visitor
as a teacher used to tell me:
“есль долга мучиться что-нибуть получиться”
man this article looks very nice to me :)
I like how you worked this out. Plus it seems you really were at the lessons were the prof were talking about DMA :). My Congrats dude!