即使我有足够的 RAM 和 CPU 可供使用,我还是无法同时完成一些工作,这让我很烦恼 - 所以这就是磁盘使用情况,例如当我使用 WinRAR 或其他需要大量磁盘写入的东西提取大档案时。
我希望能够限制这一点,比如说 20%,这样 WinRAR 就只能使用我磁盘 20% 的写入能力,这样就
“我的操作系统不再挂起,即使在解压大型档案时也可以进行多任务处理”
在执行此类磁盘密集型作业时。
如果您知道如何通过应用程序限制磁盘的 I/O,那么这将非常有帮助!
我的操作系统:Windows 7 Ultimate x64。我尝试设置进程亲和性和优先级,但没有成功。
答案1
在进程探索器,除了常规的Normal 8
、Below normal 6
、Idle 4
优先级之外,还有一个附加Background 4
级别,表示它具有Low I/O and Memory Priority
。根据相应的列,Background 4
结果是I/O 优先级。 这应该可以实现您想要的效果。Very Low
我相信它在 Vista 及更高版本中可用,因为维基百科建议当时添加了 I/O 优先级。
从您的评论来看,您似乎也想从命令行执行此操作。我不确定 Process Explorer 中是否有此功能,但是工具在这方面可能会有用。我知道PsExec
可以让你启动优先级较低的进程。如果没有,编写一个命令行程序或脚本来设置正在运行的进程的优先级应该不会太难。
答案2
@AlexandrZarubkin 的评论应该得到更多关注。指向俄语论坛 habr.com有很大帮助。特罗特尔制作了一个注册表文件,允许在资源管理器中右键单击启动可执行文件时永久更改优先级:
此文本应保存为.reg
文件并导入 Windows 注册表:
Windows Registry Editor Version 5.00
;Copyright 2016 Trottle
;This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3.
;This program is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
;See <http://www.gnu.org/licenses/> for more details.
[-HKEY_CLASSES_ROOT\exefile\shell\Bpc]
[HKEY_CLASSES_ROOT\exefile\shell\Bpc]
"HasLUAShield"=""
"MUIVerb"="Set base priority"
"subcommands"=""
[HKEY_CLASSES_ROOT\exefile\shell\Bpc\shell\01low]
"MUIVerb"="Idle CPU, lowest IO, low paging"
"Icon"="comres.dll,9"
[HKEY_CLASSES_ROOT\exefile\shell\Bpc\shell\01low\command]
@="cmd /q /c echo Windows Registry Editor Version 5.00>%%TEMP%%\\pr.reg & echo.>>%%TEMP%%\\pr.reg & for /f \"delims=<\" %%i in (\"%1\") do echo [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\%%~nxi\\PerfOptions]>>%%TEMP%%\\pr.reg & echo.>>%%TEMP%%\\pr.reg & echo \"CpuPriorityClass\"=dword:00000001>>%%TEMP%%\\pr.reg & echo.>>%%TEMP%%\\pr.reg & echo \"IoPriority\"=dword:00000000>>%%TEMP%%\\pr.reg & echo.>>%%TEMP%%\\pr.reg & echo \"PagePriority\"=dword:00000001>>%%TEMP%%\\pr.reg & regedit /s %%TEMP%%\\pr.reg & del %%TEMP%%\\pr.reg & msg * %~ni priority is set to IDLE"
[HKEY_CLASSES_ROOT\exefile\shell\Bpc\shell\02below]
"MUIVerb"="Below normal CPU, low IO"
"Icon"="comres.dll,12"
[HKEY_CLASSES_ROOT\exefile\shell\Bpc\shell\02below\command]
@="cmd /q /c echo Windows Registry Editor Version 5.00>%%TEMP%%\\pr.reg & echo.>>%%TEMP%%\\pr.reg & for /f \"delims=<\" %%i in (\"%1\") do echo [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\%%~nxi\\PerfOptions]>>%%TEMP%%\\pr.reg & echo.>>%%TEMP%%\\pr.reg & echo \"CpuPriorityClass\"=dword:00000005>>%%TEMP%%\\pr.reg & echo.>>%%TEMP%%\\pr.reg & echo \"IoPriority\"=dword:00000001>>%%TEMP%%\\pr.reg & echo.>>%%TEMP%%\\pr.reg & echo \"PagePriority\"=->>%%TEMP%%\\pr.reg & regedit /s %%TEMP%%\\pr.reg & del %%TEMP%%\\pr.reg & msg * %~ni priority is set to BELOW NORMAL"
[HKEY_CLASSES_ROOT\exefile\shell\Bpc\shell\03above]
"Icon"="comres.dll,8"
"MUIVerb"="Above normal CPU"
[HKEY_CLASSES_ROOT\exefile\shell\Bpc\shell\03above\command]
@="cmd /q /c echo Windows Registry Editor Version 5.00>%%TEMP%%\\pr.reg & echo.>>%%TEMP%%\\pr.reg & for /f \"delims=<\" %%i in (\"%1\") do echo [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\%%~nxi\\PerfOptions]>>%%TEMP%%\\pr.reg & echo.>>%%TEMP%%\\pr.reg & echo \"CpuPriorityClass\"=dword:00000006>>%%TEMP%%\\pr.reg & echo.>>%%TEMP%%\\pr.reg & echo \"IoPriority\"=->>%%TEMP%%\\pr.reg & echo.>>%%TEMP%%\\pr.reg & echo \"PagePriority\"=->>%%TEMP%%\\pr.reg & regedit /s %%TEMP%%\\pr.reg & del %%TEMP%%\\pr.reg & msg * %~ni priority is set to ABOVE NORMAL"
[HKEY_CLASSES_ROOT\exefile\shell\Bpc\shell\04high]
"MUIVerb"="High CPU"
"Icon"="comres.dll,16"
"CommandFlags"=dword:00000040
[HKEY_CLASSES_ROOT\exefile\shell\Bpc\shell\04high\command]
@="cmd /q /c echo Windows Registry Editor Version 5.00>%%TEMP%%\\pr.reg & echo.>>%%TEMP%%\\pr.reg & for /f \"delims=<\" %%i in (\"%1\") do echo [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\%%~nxi\\PerfOptions]>>%%TEMP%%\\pr.reg & echo.>>%%TEMP%%\\pr.reg & echo \"CpuPriorityClass\"=dword:00000003>>%%TEMP%%\\pr.reg & echo.>>%%TEMP%%\\pr.reg & echo \"IoPriority\"=->>%%TEMP%%\\pr.reg & echo.>>%%TEMP%%\\pr.reg & echo \"PagePriority\"=->>%%TEMP%%\\pr.reg & regedit /s %%TEMP%%\\pr.reg & del %%TEMP%%\\pr.reg & msg * %~ni priority is set to HIGH"
[HKEY_CLASSES_ROOT\exefile\shell\Bpc\shell\06ask]
"MUIVerb"="Show current priorities"
"Icon"="shell32.dll,23"
[HKEY_CLASSES_ROOT\exefile\shell\Bpc\shell\06ask\command]
@="cmd /q /c for /f \"delims=<\" %%i in (\"%1\") do reg query \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\%%~nxi\\PerfOptions\" /s | msg *"
[HKEY_CLASSES_ROOT\exefile\shell\Bpc\shell\07default]
"MUIVerb"="Restore to default"
"Icon"="comres.dll,4"
[HKEY_CLASSES_ROOT\exefile\shell\Bpc\shell\07default\command]
@="cmd /q /c echo Windows Registry Editor Version 5.00>%%TEMP%%\\pr.reg & echo.>>%%TEMP%%\\pr.reg & for /f \"delims=<\" %%i in (\"%1\") do echo [-HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\%%~nxi\\PerfOptions]>>%%TEMP%%\\pr.reg & regedit /s %%TEMP%%\\pr.reg & del %%TEMP%%\\pr.reg & msg * %~ni priority is restored to default"
; If you do not want to have uninstaller you can skip next part:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\BpcSubMenu]
"DisplayName"="'Set base priority' submenu"
"DisplayIcon"="imageres.dll,73"
"UninstallString"="cmd /q /c echo Windows Registry Editor Version 5.00>%TEMP%\\pr.reg & echo.>>%TEMP%\\pr.reg & echo [-HKEY_CLASSES_ROOT\\exefile\\shell\\Bpc]>>%TEMP%\\pr.reg & echo.>>%TEMP%\\pr.reg & echo [-HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\BpcSubMenu]>>%TEMP%\\pr.reg & regedit /s %TEMP%\\pr.reg & del %TEMP%\\pr.reg"
"DisplayVersion"="1.1"
"URLInfoAbout"="http://habrahabr.ru/post/317802/"
"NoModify"=dword:00000001
"NoRepair"=dword:00000001
优先级值列表
IoPriority Value Priority
0 Very Low
1 Low
2 Normal
3 High
4 Critical (only for memory io)
PagePriority Value Priority
0 Idle
1 Very Low
2 Low
3 Background
4 Background
5 Normal