Delphi and HDD I/O Quoting , Resource Pre-Caching , Read/Write/seek parameter limiting

*爱你&永不变心* 提交于 2020-01-04 09:18:27

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!