我怎么能/进程的O优先级增加多少? [英] How can I/O priority of a process be increased?

查看:180
本文介绍了我怎么能/进程的O优先级增加多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想增加一个进程的I / O优先级。答案为.NET和Windows Vista将是很好。 processexplorer是确定的为好。

I want to increase the I/O priority of a process. Answers for both .NET and Windows Vista would be nice. processexplorer is ok as well.

推荐答案

相关信息似乎有点散乱相比通常的MS文档。有这样白皮书讨论<一href="http://www.google.co.nz/url?sa=t&source=web&ct=res&cd=2&url=http%3A%2F%2Fdownload.microsoft.com%2Fdownload%2Fa%2Ff%2F7%2Faf7777e5-7dcd-4800-8a0a-b18336565f5b%2FPriorityio.doc&ei=6s8jSem3NqGksQOL1c3uDg&usg=AFQjCNHvihuifDRqFplOHe7Z1NY0ufmnDw&sig2=lL48ZkwbbP9KnqXn562XaQ">I/O优先级在Windows 。该文档似乎有测试标志了这一切,但我想这可能主要是pretty的准确。

The relevant information seems to be a bit scattered compared to the usual MS documentation. There is this white paper that discusses I/O Prioritization in windows. This doc seems to have beta flags all over it but I guess it's probably mostly pretty accurate.

两个重要的事情需要注意:

Two important things to note:

  1. 您只能减少低于正常IO请求的优先级。
  2. 在驱动程序可以忽略任何这样的请求,并把它当作正常的反正。

客户端应用程序有用的API是<一href="http://msdn.microsoft.com/en-us/library/aa365539(VS.85).aspx">SetFileInformationByHandle:

The useful APIs for client applications are SetFileInformationByHandle:

FILE_IO_PRIORITY_HINT_INFO priorityHint;
priorityHint.PriorityHint = IoPriorityHintLow;
result = SetFileInformationByHandle( hFile,
                                     FileIoPriorityHintInfo,
                                     &priorityHint,
                                     sizeof(PriorityHint));

SetPriorityClass

// 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);

<一个href="http://msdn.microsoft.com/en-us/library/aa365537(VS.85).aspx">SetFileBandwithReservation:

// reserve bandwidth of 200 bytes/sec
result = SetFileBandwidthReservation( hFile,
                                  1000,
                                  200,
                                  FALSE,
                                  &transferSize,
                                  &outstandingRequests );

对于.NET做平常的东西以P / Invoke的。

For .Net do the usual stuff with P/Invoke.

这篇关于我怎么能/进程的O优先级增加多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆