I'm looking for a way to limit the CPU usage by any application on Windows 7 to 50%. I've tried searching the Internet for a way to do this, and it looks like this is an easy thing to do on Linux and Mac OS X (one command in the terminal) but I'm not sure how to do it on Windows 7. Any help would be much appreciated. Thanks!
我正在寻找一种方法,将Windows 7上的任何应用程序的CPU使用率限制在50%以内。我尝试过在互联网上搜索这样做的方法,看起来这在Linux和Mac OS X(终端中的一个命令)上是很容易做到的,但我不确定如何在Windows 7上做到这一点。如有任何帮助,我们将不胜感激。谢谢!
Rohan
罗翰
5 个解决方案
#1
6
You can use BES. It throttles CPU-hungry applications when asked. You can limit 3 programs maximum. I use this to run multiple online game clients and it works like a charm for me. You should run it with admin privilidges and in windows xp sp3 compatible mode. To adjust these settings, right click on the executable and chose options.
您可以使用喜神贝斯。当被问到这个问题时,它会扼杀cpu的应用。你最多可以限制3个程序。我用它来运行多个在线游戏客户端,这对我来说很有吸引力。您应该使用管理特权和windows xp sp3兼容模式运行它。要调整这些设置,右键单击可执行文件并选择选项。
Here's the link for BES - CPU limiter.
这是BES - CPU限制器的链接。
#2
4
If you are on a multi-core processor, you can right click the process in the task manager and set the affinity. This will define which cores are allowed to run the process. Uncheck half of the cores and the process will use 50%.
如果在多核处理器上,可以在任务管理器中右键单击进程并设置关联。这将定义允许哪个核心运行流程。打开一半的核,这个过程将使用50%。
Or see this to do it programagically: Set affinity with start /AFFINITY command on Windows 7
或者通过编程实现:在Windows 7上使用start / affinity命令设置关联性
#3
3
You can't limit the CPU usage of a process on Windows 7 or earlier as this resource is managed by the OS*.
您不能限制Windows 7或更早版本的进程的CPU使用,因为该资源是由OS*管理的。
However, you can specify to run a process with a certain priority, e.g. to run below normal priority. The various scheduling priorities can be set using the SetPriorityClass
API function.
但是,您可以指定运行具有一定优先级的进程,例如运行在正常优先级以下。可以使用SetPriorityClass API函数设置各种调度优先级。
调度优先级
What you are probably trying to prevent is that your process affects the performance of the system in a way that the user would notice. In that case, setting appropriate priorities will be a solution. After all, you got an expensive CPU so why not use it whenever you can?
您可能正在试图防止的是,您的流程以用户可能注意到的方式影响系统的性能。在这种情况下,制定适当的优先事项将是一种解决办法。毕竟,您有一个昂贵的CPU,所以为什么不尽可能地使用它呢?
* See @Ben Voigt's answer for a possible solution on Windows 8 and above.
*见@Ben Voigt对Windows 8及以上版本的解决方案的答案。
#4
3
You can limit the CPU usage of your process or any other process by adding the process of interest to a Job object, and placing limits on the Job object.
通过向作业对象添加感兴趣的进程并对作业对象设置限制,可以限制进程或任何其他进程的CPU使用。
One of the resource limits which can be configured for Job objects is CPU usage:
可以为作业对象配置的资源限制之一是CPU使用率:
-
JOBOBJECT_BASIC_LIMIT_INFORMATION
available since Windows XP and 2003 - JOBOBJECT_BASIC_LIMIT_INFORMATION自Windows XP和2003年以来可用
-
JOBOBJECT_CPU_RATE_CONTROL_INFORMATION
new in Windows 8 and Server 2012. - JOBOBJECT_CPU_RATE_CONTROL_INFORMATION新出现在Windows 8和Server 2012上。
If you have to use JOBOBJECT_BASIC_LIMIT_INFORMATION
, pay careful attention to the note:
如果您必须使用JOBOBJECT_BASIC_LIMIT_INFORMATION,请注意下面的说明:
To register for notification when this limit is exceeded without terminating processes, use the SetInformationJobObject function with the JobObjectNotificationLimitInformation information class
若要在未终止进程的情况下超出此限制时注册通知,请使用带有jobobjectnotificationlimitationinformation类的SetInformationJobObject函数
And then use JOBOBJECT_END_OF_JOB_TIME_INFORMATION
instead, since that's available pre-Windows 8.
然后使用JOBOBJECT_END_OF_JOB_TIME_INFORMATION,因为这是windows 8之前可用的。
#5
1
You can use an excellent program called "process lasso".
你可以使用一个叫做“过程套索”的优秀程序。
In lasso you can, for example, limit some specific program to 1 CPU and low priority. Every copy of that program will run with these settings. I have used this program to manage CPU on terminal server and it worked very well!
例如,在lasso中,您可以将某些特定的程序限制为一个CPU和低优先级。该程序的每个副本都将使用这些设置运行。我使用这个程序来管理终端服务器上的CPU,它运行得很好!
#1
6
You can use BES. It throttles CPU-hungry applications when asked. You can limit 3 programs maximum. I use this to run multiple online game clients and it works like a charm for me. You should run it with admin privilidges and in windows xp sp3 compatible mode. To adjust these settings, right click on the executable and chose options.
您可以使用喜神贝斯。当被问到这个问题时,它会扼杀cpu的应用。你最多可以限制3个程序。我用它来运行多个在线游戏客户端,这对我来说很有吸引力。您应该使用管理特权和windows xp sp3兼容模式运行它。要调整这些设置,右键单击可执行文件并选择选项。
Here's the link for BES - CPU limiter.
这是BES - CPU限制器的链接。
#2
4
If you are on a multi-core processor, you can right click the process in the task manager and set the affinity. This will define which cores are allowed to run the process. Uncheck half of the cores and the process will use 50%.
如果在多核处理器上,可以在任务管理器中右键单击进程并设置关联。这将定义允许哪个核心运行流程。打开一半的核,这个过程将使用50%。
Or see this to do it programagically: Set affinity with start /AFFINITY command on Windows 7
或者通过编程实现:在Windows 7上使用start / affinity命令设置关联性
#3
3
You can't limit the CPU usage of a process on Windows 7 or earlier as this resource is managed by the OS*.
您不能限制Windows 7或更早版本的进程的CPU使用,因为该资源是由OS*管理的。
However, you can specify to run a process with a certain priority, e.g. to run below normal priority. The various scheduling priorities can be set using the SetPriorityClass
API function.
但是,您可以指定运行具有一定优先级的进程,例如运行在正常优先级以下。可以使用SetPriorityClass API函数设置各种调度优先级。
调度优先级
What you are probably trying to prevent is that your process affects the performance of the system in a way that the user would notice. In that case, setting appropriate priorities will be a solution. After all, you got an expensive CPU so why not use it whenever you can?
您可能正在试图防止的是,您的流程以用户可能注意到的方式影响系统的性能。在这种情况下,制定适当的优先事项将是一种解决办法。毕竟,您有一个昂贵的CPU,所以为什么不尽可能地使用它呢?
* See @Ben Voigt's answer for a possible solution on Windows 8 and above.
*见@Ben Voigt对Windows 8及以上版本的解决方案的答案。
#4
3
You can limit the CPU usage of your process or any other process by adding the process of interest to a Job object, and placing limits on the Job object.
通过向作业对象添加感兴趣的进程并对作业对象设置限制,可以限制进程或任何其他进程的CPU使用。
One of the resource limits which can be configured for Job objects is CPU usage:
可以为作业对象配置的资源限制之一是CPU使用率:
-
JOBOBJECT_BASIC_LIMIT_INFORMATION
available since Windows XP and 2003 - JOBOBJECT_BASIC_LIMIT_INFORMATION自Windows XP和2003年以来可用
-
JOBOBJECT_CPU_RATE_CONTROL_INFORMATION
new in Windows 8 and Server 2012. - JOBOBJECT_CPU_RATE_CONTROL_INFORMATION新出现在Windows 8和Server 2012上。
If you have to use JOBOBJECT_BASIC_LIMIT_INFORMATION
, pay careful attention to the note:
如果您必须使用JOBOBJECT_BASIC_LIMIT_INFORMATION,请注意下面的说明:
To register for notification when this limit is exceeded without terminating processes, use the SetInformationJobObject function with the JobObjectNotificationLimitInformation information class
若要在未终止进程的情况下超出此限制时注册通知,请使用带有jobobjectnotificationlimitationinformation类的SetInformationJobObject函数
And then use JOBOBJECT_END_OF_JOB_TIME_INFORMATION
instead, since that's available pre-Windows 8.
然后使用JOBOBJECT_END_OF_JOB_TIME_INFORMATION,因为这是windows 8之前可用的。
#5
1
You can use an excellent program called "process lasso".
你可以使用一个叫做“过程套索”的优秀程序。
In lasso you can, for example, limit some specific program to 1 CPU and low priority. Every copy of that program will run with these settings. I have used this program to manage CPU on terminal server and it worked very well!
例如,在lasso中,您可以将某些特定的程序限制为一个CPU和低优先级。该程序的每个副本都将使用这些设置运行。我使用这个程序来管理终端服务器上的CPU,它运行得很好!