问题
I have dynamic array filled with bytes, which are read from .raw file with BlockRead() and this operation, logically, requires hell of a Shell resources and I wanted to know if there is any methods to reserve some amount or limit maximum amount of Read/Write/Seek used for Program run time from Hard Disk Drive*****
[Clarification]: I meant to set maximum reading speed from HDD while performing action with windows shell / internal app resources. In this moment app is very sensitive to hdd's performance, but it causes on several machines to freeze / lock because system cannot manage disk operations...
I wanted to know about any methods, tutorials, in worst case unit in which function declarations and class info can be found.
As much I know, Pascal as the base of Delphi does not provide very easy approach as the best could be TStream or TPipeline usage (TSocket should not be good, right?)... As much I have used streams, I did not like it because there were some underwater stones with TFileStream ...
Anyway - please give me at least intro to disk performance management...
回答1:
I'm afraid there's no way to throttle the IO activity using the Windows API or some Delphi function. (Unlike threads for example)
You can only slow down your IO accesses by adding Sleep commands or something similar into your code.
You could read the current IO activity using WMI and increase your delays if there's high IO activity.
回答2:
RE: "I meant to set maximum reading speed from HDD..."
Just do the throttling yourself. Do disk access in the background thread and throttle operations according to whatever throughput you need.
来源:https://stackoverflow.com/questions/1096498/delphi-and-hdd-i-o-quoting-resource-pre-caching-read-write-seek-parameter-li