Is there a way to limit how fast a program can read from files without slowing the program itself down?
migrated from stackoverflow.com Oct 31 '12 at 0:26
This question came from our site for professional and enthusiast programmers.
On Windows Vista and above, you can set the I/O priority of a process. This won't limit the rate, but will give other processes priority over your process and allow them to take precedence. There are hidden APIs to do so, but it seems what you're looking for is a tool. When you set the process priority, using task manager, to Below Normal or Idle, the I/O priority drops too.
This question on suepruser has more information:
It also links to this project that allows you to set I/O priority.
Not sure about hardware or OS-specific solutions... But the obvious leaps out (forgive the crude implementation):
This is only relevant if you are reading chunks. I suppose you could derive from the stream and overload the relevant methods. Starts getting a bit yuck. But it's a simple and quick workaround if you can't find a lower-level solution.