Limit the use of processor cores by an application

To distribute the load or limit the excessive use of processor resources, you can allocate only the specified cores to the application to run. This can be done in the task manager.

If you plan to always run the application with the specified restrictions, you can create a cmd file that will launch it with the required parameters.

start /affinity 1 Application_Path

The parameter in which the core numbers are transmitted must be a hexadecimal number and be formed depending on the number of cores in the processor, in this example there are 8.

First, we form a binary number, according to the number of characters corresponding to the number of cores - 00000000. The numbers correspond to the cores in the opposite direction. That is, if you need to use only the zero core, replace the last zero with 1 - 00000001. The zero and the second, respectively, 00000101, and so on.

In the resulting binary number 00000101, the leading zeros have no meaning, we cut them off, we get 101. Now we need to convert it to hexadecimal. This can be done, for example, with a conventional calculator in programming mode. We get 101 = 5. Now we start notepad using only the zero and second cores:

start /affinity 5 C:\windows\notepad.exe

Author: admin