tags:

views:

370

answers:

2

Can anyone recommend a way in which I can throttle an application based on the current disk usage or even CPU usage.

The application I am writing scans files on the hard disk and will be pretty hard disk intensive in itself. Can anyone recommend a way in which I can either throttle down my application(or even pause it for that matter) when the disk usage is high(i.e. user himself is running very HDD or CPU intensive app)? Basically my application shouldn't hamper user's productivity. I know this is a pretty big research topic in itself. But I at least need some cues on how would I approach this.

Help in any form is highly appreciated. :)

Thanks.
Samrat.

A: 

Take a look at this ("How can I programmatically limit my program’s CPU usage to below 70%?") and this ("Win32 Thread scheduling#The Larry Osterman answer")

Shay Erlichmen
+1  A: 

Vista has added I/O Prioritization to Windows so if you're using that platform you can just let the O/S take care of it.

For other operating systems maybe finding the I/O latency, and if it is over some predefined threshold then sleep your disk scanner for a bit would work?

danio