BetaArchive Logo
Navigation Home Screenshots Image Uploader Server Info FTP Servers Wiki Forum RSS Feed Rules Please Donate
UP: 24d, 2h, 13m | CPU: 10% | MEM: 5642MB of 11027MB used
{The community for beta collectors}

Post new topic Reply to topic  [ 12 posts ] 
Author Message
 PostPost subject: Rouge CPU usage and bad SATA drivers/configuration        Posted: Thu Apr 16, 2009 9:58 am 
Reply with quote
Administrator
User avatar
Offline

Joined
Fri Aug 18, 2006 11:47 am

Posts
12473

Location
Merseyside, United Kingdom

Favourite OS
Microsoft Windows 7 Ultimate x64
Howdy all,

Last night I noticed something very strange occurring on my home server. Most people wouldn't notice it, but I'm quite observant and it caught my eye. Whenever I was copying a file/folder from disk to disk, or performing any task that was high in disk I/O operations, the CPU usage would shoot up to 50%, 100% of a single core. However, upon looking in the processes tab of task manager, there were no processes using this 50% CPU! I even checked that the "show processes from all users" check box was clicked, but still there were no processes using it. The other strange thing is that it was showing 280 minutes to copy this data from drive to drive. 50.5GB (my music folder) shouldn't take that long to copy as its 2 separate disks.

After a quick Google search about the problem, I discovered it is most likely a driver issue. Its not a process using the CPU time, its the driver. Of course it hadn't taken me long to narrow it down to the RAID drivers as it happened on every drive connected via SATA. The IDE boot drive was fine. I proceeded to check the ASUS site for any new drivers, but they were already up to date. I tried the Windows Update method of updating the drivers, and it reverted it back to a generic Windows SATA driver?! Strange, you'd think the manufacturer driver would be more up to date. Never-the-less I tried it with the Windows driver, but the result was the same.

Then I had a thought. There are several options in the BIOS related to SATA configurations. Namely 3. IDE, RAID and AHCI. IDE is of course the most compatible, as it simply runs the SATA drives as IDE drives, so operating systems from XP and below can pick them up without additional drivers. RAID would run it in RAID mode so I could have configurations such as RAID0, RAID1 and RAID5, but these require drivers too and would destroy the data on the drives if I attempted to configure them as such. AHCI is a configuration I've previously avoided however, since I had issues with it on my laptop when I first got it. AHCI requires a driver to be able to detect the drive. Once its installed, you can run in AHCI mode quite happily, but before that you have to have the driver loaded or it won't detect the hard drive. This is the problem I had with my laptop, so to solve it I simply put it into IDE mode, and its stayed there ever since.

I had the idea that I could try changing the SATA mode to AHCI, boot into Windows off the already IDE boot drive, and install the drivers there no problem. No data would be lost as its just a straight "swap" if you like into a different mode. So thats what I did, I set it to AHCI mode, rebooted and installed the SATA driver again. It auto detected as AHCI and within a few minutes my drives were back online. Now to test it...

I copied my music folder (50.5GB), and pasted it to the Backup drive, a physically separate disk to the one it was currently on. With task manager open, I observed the CPU usage... 12% while it was preparing to copy... A few seconds later and it started to copy... 19% CPU... Yes! It had worked. And whats more, the copy time was down from 280 minutes to 22 minutes! What a result! Its amazing the difference a simple driver/configuration change can make.

So, what can you learn from this? Well, unless you're really into performance, not a lot, but check your SATA mode next time you're in your BIOS, and check if its set to IDE or AHCI. If its on IDE, give AHCI a whirl (but not if your boot drive is SATA, or you'll never get in unless you install the AHCI driver first). You'll probably see a huge performance increase, and all at the expense of installing another driver and changing that configuration. At least if it doesn't work you can always revert back to IDE mode and all will be well. Try it, you have nothing to lose!

_________________
Image

BetaArchive Discord: https://discord.gg/epK3r6A


Top  Profile  WWW
 PostPost subject: Re: Rouge CPU usage and bad SATA drivers/configuration        Posted: Thu Apr 16, 2009 5:43 pm 
Reply with quote
Administrator
User avatar
Offline

Joined
Tue Feb 12, 2008 5:28 pm

Posts
7430
One important thing I mentioned to Andy in correlation to this is that AHCI does a lot more than just force a driver change. AHCI enables the NCQ (an old SCSI feature) feature in all supported SATA-drives (which of course needs a supported SATA controller) which allows the harddrive to more efficiently manage the data loading.

As all of you should know the speed of harddrive data reads rely mostly on how fast the heads can move across the platter surface. If the head has to move quickly between different places on the platter to retrieve data you get a lot of slowdown, and you hear this by listening to the drive, you'll hear the common repetitive tick-tick-tick-tick sound.

Here's a rough example of what NCQ does:

Say that the inner part (which is also the slowest part) of one harddrive platter is data block 1000 and the outer part is data block 1. You're trying to play your favorite game and the processor tells the harddrive to load the game. Unfortunately the game is stored on both the beginning data blocks and end blocks (say block 1-250 and 900-1000). So by trying to load the game the drive goes nuts, it starts to move between the start and end blocks until it finished reading the data it needs for the game. Since the drive gets its commands sequentially the harddrive controller tells the drive:

"Read from data block 1, 900, 3, 902, 10, 800, 2, 790!" and on and on. As you see this will cause the heads to move back and forth between the outer and inner parts of the platter. Sure the harddrive heads move fast, but this delay will cause a significant speed penalty dropping the reading speed. It will also stress the mechanics of the drive which of course will kill the drive eventually.

What NCQ does is simple. It precaches a certain amount of IO commands and sort them. Then it executes them sequentially. So "Read from data block 1, 900, 3, 902, 10, 800, 2, 790!" becomes "Read from data block 1, 2, 3, 10, 790, 800, 900!". As you see this will be much more efficient, since the time for the head to move between data block 1 and 2 is much less than 1 and 900. It will read the first blocks very fast, then move the heads to the outer area and then read the rest. It will cause less head movement, less mechanical stress and improve reading speed a lot, thus loading your game faster. Since it reads data so fast it can simply pre-cache the read data and then feed the CPU the data properly in the other it requested, even if the harddrive sorted it in a different way.

I can also note that by defragmenting the harddrive you actually move all the relative data blocks together. So if an app is spread out on many data blocks it moves them together so when the computer needs to read a file it can read all of it with as little head movement as possible. Smarter defrag software also considers what files belong to what folder, what folders belong to what application and how often that application is used, thus speeding up reading of the data even further. The built in defragmenter in Windows only bothers with file-based sorting, i.e it puts all the blocks together that makes up a single file. It doesn't bother with folders or how frequent you read them.

I often hear people complaining that Windows often runs slow. You can get quite a performance boost if you switch to AHCI. XP doesn't support AHCI by default and needs its floppy drive during installation to properly load. If you don't have a floppy drive then I suggest you make your own XP install CD by injecting your AHCI drivers into a custom install CD. Use XPLite or BartPE for that. Windows Vista and Win7 has native support for AHCI devices so you will not have any problems unless you got special hardware (such as PCI/PCI-express based RAID controllers etc). Remember that while RAID mode enables AHCI it doesn't mean that Windows will see it, you may need drivers for RAID even in Windows Vista and Win7 (and you most definately will need it in Windows XP and older).

One important thing is that you never have to defragment an SSD drive, or any flash-based drive. Access to any sector on the drive is the same, so the computer will not benefit from sorting the data in the memory cells. At worst defragmenting a flash device will actually make it go bad faster (by wearing out the data cells faster) and even make it slower since it will not utilize the cells properly. Modern flash harddrives supports NCQ as well, but instead of using it to sort commands to read it faster it uses it to sort command to write the data more efficiently. But that's an entire different mechanism for writing data to a memory cell than a data block on a harddrive and I will not explain it here (unless requested).

If you want to test the speed of your harddrive in both sequential read (when the data is sorted and put together on a drive) and random (where the head moves across the platter as if the data was fragmented) you can easily do that with a benchmark program. I recommend a simple program called Crystal DiskMark (http://crystalmark.info). The application doesn't need any installation, you can read it off an USB drive and you can test everything from harddrives to flash drives and network shares. I also recommend to check out their other tools which are quite useful.

I hope you people understood my examples, or I'll have to enable AHCI in my brain and rewrite and optimize my post :P.

_________________
Image
Official guidelines: The Definitive Guide to BetaArchive :: Abandonware
Tools: Alcohol120% (Portable)
Listings: BetaArchive Database (beta)
Channels: Discord :: Twitter


Top  Profile  WWW
 PostPost subject: Re: Rouge CPU usage and bad SATA drivers/configuration        Posted: Thu Apr 16, 2009 5:53 pm 
Reply with quote
Donator
User avatar
Offline

Joined
Sat May 12, 2007 1:05 pm

Posts
5271

Location
The Collection Book

Favourite OS
Windows & Phone
Does this also works for harddrives that are in external drives (via USB connected?)

_________________
Image
http://www.thecollectionbook.info
Subscribe to our Image for updates and like us on Image.

Reading Mode only, PM's possible.


Top  Profile  WWW
 PostPost subject: Re: Rouge CPU usage and bad SATA drivers/configuration        Posted: Thu Apr 16, 2009 5:54 pm 
Reply with quote
Staff
User avatar
Offline

Joined
Thu Oct 23, 2008 3:25 am

Posts
2688

Location
Earth.

Favourite OS
Real Life
what does AHCI stand for? how much extra speed does it give you?

_________________
Visit my BLOG!
Wanna play a fun browser based game that plays while you're away? Click here.


Top  Profile  WWW  YIM
 PostPost subject: Re: Rouge CPU usage and bad SATA drivers/configuration        Posted: Thu Apr 16, 2009 6:03 pm 
Reply with quote
Donator
User avatar
Offline

Joined
Sat May 12, 2007 1:05 pm

Posts
5271

Location
The Collection Book

Favourite OS
Windows & Phone
I just tried it, but to no avail.

I have enabled it in the BIOS and rebooted.
It started the original BIOS start-up screen and then loaded the AHCI BIOS and detected the drives, good.
But then I started windows, but it BSOD right away.

Tryed it again, but still BSOD (then tryed another SATA drive, but also then it BSOD).
So, you must enable it and then install it after it has been enabled?

_________________
Image
http://www.thecollectionbook.info
Subscribe to our Image for updates and like us on Image.

Reading Mode only, PM's possible.


Top  Profile  WWW
 PostPost subject: Re: Rouge CPU usage and bad SATA drivers/configuration        Posted: Thu Apr 16, 2009 6:03 pm 
Reply with quote
Donator
Offline

Joined
Sat Feb 24, 2007 4:14 pm

Posts
6612

Location
United Kingdom

Favourite OS
Server 2012 R2
If like me, you've installed Vista and 7 with IDE Mode, and would now like to switch to AHCI, you can enable the driver without reinstalling or even performing a repair install:

http://support.microsoft.com/default.aspx/kb/922976

_________________
BuildFeed - the ultimate collaborative NT build list - Windows Longhorn - a look at a defining Microsoft project


Top  Profile  WWW
 PostPost subject: Re: Rouge CPU usage and bad SATA drivers/configuration        Posted: Thu Apr 16, 2009 6:19 pm 
Reply with quote
Donator
User avatar
Offline

Joined
Sat May 12, 2007 1:05 pm

Posts
5271

Location
The Collection Book

Favourite OS
Windows & Phone
It works now.

Not much difference yet because my disk is not really fragmented, but anyway, it works, and it responds a bit faster, but we will see overtime.

_________________
Image
http://www.thecollectionbook.info
Subscribe to our Image for updates and like us on Image.

Reading Mode only, PM's possible.


Top  Profile  WWW
 PostPost subject: Re: Rouge CPU usage and bad SATA drivers/configuration        Posted: Thu Apr 16, 2009 8:11 pm 
Reply with quote
Administrator
User avatar
Offline

Joined
Tue Feb 12, 2008 5:28 pm

Posts
7430
DjRob wrote:
Does this also works for harddrives that are in external drives (via USB connected?)


No. It requires the SATA interface for it, and generally only supported by the "SATA2/SATA-II" standard even if it's possible to add NCQ to a SATA1 drive.

pizzaboy192 wrote:
what does AHCI stand for? how much extra speed does it give you?


Advanced Host Controller Interface.

Speed depends and it may not give much in your configuration, but since the speed increase depends on what's read and where it may vary. I've measured up to 40-50% improvement in ideal situations (when streaming data), but it may also not give any improvement at all. But generally AHCI improves overall performance (as Andy's situation demonstrated) since AHCI allows data to flow directly between RAM and the harddrives without involving the CPU. IDE mode still needs some CPU involvement, especially with older legacy motherboards and IDE controllers.


DjRob wrote:
I just tried it, but to no avail.

I have enabled it in the BIOS and rebooted.
It started the original BIOS start-up screen and then loaded the AHCI BIOS and detected the drives, good.
But then I started windows, but it BSOD right away.

Tryed it again, but still BSOD (then tryed another SATA drive, but also then it BSOD).
So, you must enable it and then install it after it has been enabled?


That is because Windows can't find the harddrive since now it's on a different "controller" (the system presents itself on an AHCI controller now, not the legacy IDE). Remember, AHCI isn't supported by default in Windows XP (which I am guessing you're using), so you need to install the AHCI driver BEFORE switching the setting in BIOS. EDIT: I see Hounsell gave you an example of how to do it. Good :).

In your case you should perhaps just wait until you reinstall or upgrade before switching. Remember to streamline your XP install disc with the AHCI drivers if you use XP.

You won't see any tremendous differences no, but generally it will give you a better run in Windows since less CPU time is used for your data transfers, and when NCQ kicks in you will gain some performance when it's possible. And you can also hotswap your drives safely now (in case you got an external eSATA enclosure etc) :).

_________________
Image
Official guidelines: The Definitive Guide to BetaArchive :: Abandonware
Tools: Alcohol120% (Portable)
Listings: BetaArchive Database (beta)
Channels: Discord :: Twitter


Top  Profile  WWW
 PostPost subject: Re: Rouge CPU usage and bad SATA drivers/configuration        Posted: Thu Apr 16, 2009 8:38 pm 
Reply with quote
Donator
User avatar
Offline

Joined
Sat May 12, 2007 1:05 pm

Posts
5271

Location
The Collection Book

Favourite OS
Windows & Phone
mrpijey wrote:
That is because Windows can't find the harddrive since now it's on a different "controller" (the system presents itself on an AHCI controller now, not the legacy IDE). Remember, AHCI isn't supported by default in Windows XP (which I am guessing you're using), so you need to install the AHCI driver BEFORE switching the setting in BIOS. EDIT: I see Hounsell gave you an example of how to do it. Good :).


It did the trick with just after installation enabling it in the registery.
Also my ''main'' OS is Windows 7 Ultimate 7077, have also in dual-boot with Vista (also enabled).

But my schoolharddrive is Windows XP x64 (self installed here and with hardware profiles also used at school because the installation at school ''sucks'', even the teachers complain).

But there it is not enabled.
But it doesn't matter, I have that drive formatted in a few months anyway because then I am done and have my internship and then it's off to work.

_________________
Image
http://www.thecollectionbook.info
Subscribe to our Image for updates and like us on Image.

Reading Mode only, PM's possible.


Top  Profile  WWW
 PostPost subject: Re: Rouge CPU usage and bad SATA drivers/configuration        Posted: Thu Apr 16, 2009 10:12 pm 
Reply with quote
Donator
User avatar
Offline

Joined
Fri Jun 13, 2008 10:22 am

Posts
2366
If you're running in IDE mode and want to move to AHCI in Windows XP you can just install the drivers before changing over to AHCI. Windows Vista/Server 2008/7/S2008R2 all support AHCI natively so you don't really need to install drivers.


Top  Profile
 PostPost subject: Re: Rouge CPU usage and bad SATA drivers/configuration        Posted: Mon Apr 20, 2009 9:55 am 
Reply with quote
Donator
Offline

Joined
Thu Nov 08, 2007 6:08 am

Posts
819

Location
Malaysia
mrpijey wrote:
No. It requires the SATA interface for it, and generally only supported by the "SATA2/SATA-II" standard even if it's possible to add NCQ to a SATA1 drive.

So does that mean I can try that tips on eSATA connected external HDD? Cool! I'll try when I'm back home on my HDD, thanks ^^

_________________
Image


Top  Profile  WWW  YIM
 PostPost subject: Re: Rouge CPU usage and bad SATA drivers/configuration        Posted: Mon Apr 20, 2009 5:21 pm 
Reply with quote
Staff
User avatar
Offline

Joined
Sun Nov 09, 2008 12:09 am

Posts
2480

Location
Bristol, UK

Favourite OS
Windows 8
hounsell wrote:
If like me, you've installed Vista and 7 with IDE Mode, and would now like to switch to AHCI, you can enable the driver without reinstalling or even performing a repair install:

http://support.microsoft.com/default.aspx/kb/922976


A-ha, never knew that.

_________________
Image


Top  Profile  WWW
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 




Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

All views expressed in these forums are those of the author and do not necessarily represent the views of the BetaArchive site owner.

Powered by phpBB® Forum Software © phpBB Group

Copyright © 2006-2018

 

Sitemap | XML | RSS