How to manually allocate processor cores to a program in Windows 10
Windows 10 has a lot of options that you can play around with to get better performance. Windows 10’s CPU Affinity and CPU Priority features are some of the most ingenious, and while they’re not a silver bullet for instant performance improvements, they will make a difference if you have aging hardware.
Considering the sensitivity of the processes, you should only set CPU affinity and CPU priority if you are comfortable with things going wrong. However, if you’re ready to tweak your system to be the best it can be, let’s explore how to set CPU affinity and CPU priority in Windows 10.
What is processor affinity in Windows 10?
Every operating system has an underlying scheduling algorithm. The scheduling algorithm is responsible for distributing computing resources to different processes or threads. In Windows 10, hundreds of processes can be running at the same time.
The processor cannot handle all of these processes simultaneously. The scheduling algorithm therefore manages these processes and allocates processor time to them based on several factors.
As such, Processor Affinity can be viewed as a user interfering in the scheduler. Normally, the Windows scheduling algorithm decides which process will run on which processor core. If you manually set the processor affinity, you can force a process or thread to run on the core of your choice.
Simply put, Processor Affinity allows you to assign one or more processor cores to any process or thread of your choice. The processes or threads for which you set the affinity will only run on the specified cores.
However, this will not make the cores exclusive to these processes only. Windows can still assign different processes to these cores. Setting processor affinity only affects the processes you choose by making them run only on the affected cores.
What is CPU priority in Windows 10?
As we explained above, there can be hundreds of processes or threads competing for CPU time at any time in Windows 10. To ensure that important processes and threads get priority access to them. CPU resources, Windows Calendar assigns priority to each process and thread. running on the operating system.
For example, the Windows scheduling algorithm gives high priority to critical Windows processes such as Windows System and Explorer. If these processes are in a queue, they will have access to the processor before the low priority processes.
So when you manually set the CPU priority of a process to high, Windows Scheduler will make sure that process gets priority access to CPU resources.
Finally, CPU Priority is quite different from Processor Affinity. When setting the processor priority of a process tells the calendar how to handle that process, setting the processor affinity locks a process on one or more specific processor cores. With processor affinity set, even if the process has a high or low priority, it will run on the specified core (s).
Why you might want to assign programs to specific processor cores
One of the biggest problems modern computing faces is a large number of single-threaded programs. Even in 2021, when most processors are quad-core or higher, some programs only take advantage of one of the many available cores.
This poses a problem for modern operating system planners: How do you schedule single-threaded processes on multithreaded processors without breaking compatibility?
For the most part, modern planners efficiently schedule single-threaded processes on modern processors. But sometimes it happens that a legacy program crashes due to poor compatibility. This is where tuning the processor affinity can help.
Processor affinity restricts processes to running on specified processor cores. For legacy single-threaded programs, you can restrict these processes to a single processor core by setting processor affinity.
Apart from that, people with weaker machines can also be given high priority for their important tasks. For example, if you are a video editor, you can set your renderer to high priority before you start rendering video. That way, when you want to render a video, Windows knows how to devote most of its attention to playing your video.
How to set processor affinity and processor priority
To set processor affinity and processor priority, you will need to open task manager and continue from there.
So, open Task Manager by right clicking on Windows 10 taskbar and selecting Task Manager. Then go to the process for which you want to set the affinity.
Then right click on this process and choose Go to details.
The process you choose will be highlighted in the new panel that appears. Right click on the highlighted process and select Define affinity. The Processor Affinity panel will now appear.
In the Processor Affinity panel, deselect the processor cores on which you do not want the process to run. Then click on OK. The processor affinity will now be set and the process you have chosen will only run on the selected processor cores.
To set processor priority, right click on any process in Task Manager and select Go to details.
Then right click on the highlighted process and click Set priority.
Now choose the priority from the list that appears. If you want your process to run as soon as it needs it, select Real time.
However, the choice Real time will cause other potentially critical system processes to wait in the queue. This can lead to general system slowdown in the lightest case and complete system failure in the worst case, so be careful when setting a process to Realtime priority.
High Priority, on the other hand, is safer to select as long as you don’t set too many processes high priority.
The other options in the list, namely Above normal, Normal, Below normal, and Moo, are self-explanatory.
Don’t set CPU affinity and CPU priority if you don’t know what you are doing
You should only set processor affinity and processor priority if you know what you are doing. The performance boost, while major in some cases, is not worth the trouble you may run into if something goes wrong. From slowdowns to random system crashes, setting affinity and priority should be just your last option.
CPU affinity and CPU priority aren’t the only ways to boost Windows 10 performance. There are a myriad of hardware and software tricks you can use to get performance from your aging hardware.
It’s not hard to make Windows 10 faster. Here are several methods to improve the speed and performance of Windows 10.
About the Author