与通常的MS文档相比,相关信息似乎有点分散.有这篇白皮书讨论了
I/O Prioritization in windows.这个文档似乎有beta标志,但我猜这可能是非常准确的.
原文链接:https://www.f2er.com/windows/371061.html两个重要的事情要注意:
>您只能将IO请求的优先级降低到正常值以下.
>司机可以忽略任何这样的请求,并将其视为正常.
客户端应用程序的有用API为SetFileInformationByHandle:
FILE_IO_PRIORITY_HINT_INFO priorityHint; priorityHint.PriorityHint = IoPriorityHintLow; result = SetFileInformationByHandle( hFile,FileIoPriorityHintInfo,&priorityHint,sizeof(PriorityHint));
// reduce cpu,page and IO priority for the whole process result = SetPriorityClass( GetCurrentProcess(),PROCESS_MODE_BACKGROUND_BEGIN); // do stuff result = SetPriorityClass( GetCurrentProcess(),PROCESS_MODE_BACKGROUND_END);
SetThreadPriority这是相似的:
// reduce cpu,page and IO priority for the current thread SetThreadPriority(GetCurrentThread(),THREAD_MODE_BACKGROUND_BEGIN); // do stuff SetThreadPriority(GetCurrentThread(),THREAD_MODE_BACKGROUND_END);
// reserve bandwidth of 200 bytes/sec result = SetFileBandwidthReservation( hFile,1000,200,FALSE,&transferSize,&outstandingRequests );
对于.Net做普通的东西P / Invoke.