The best way to Manually Allocate CPU Cores to a Program on Home windows 10

Windows 10 has a lot of options that you can play around with for better performance. Windows 10's processor affinity and CPU priority features are some of the most ingenious, and while they're not a silver bullet for instant performance gains, they make a difference when you have aging hardware.

Given the sensitivity of the processes, setting the processor affinity and CPU priority should only be when you are happy with things going south. However, when you're ready to tweak your system to be the best it can, let's see how to set processor affinity and priority in Windows 10.

What is processor affinity in Windows 10?

Every operating system has an underlying planning algorithm. The scheduling algorithm is responsible for distributing computer resources to different processes or threads. Hundreds of processes can run concurrently in Windows 10.

The CPU cannot handle all of these processes at the same time, so the scheduling algorithm manages these processes and allocates CPU time to them based on several factors.

As such, Processor Affinity can be thought of as a user interfering with the scheduler. The Windows scheduling algorithm usually decides which process is executed on which CPU core. By manually setting processor affinity, you can force a process or thread to run on any core.

Put simply, Processor Affinity allows you to assign one or more CPU cores to any process or thread of your choice. The processes or threads that you set affinity for will only run on the specified cores.

However, this not only makes the cores exclusive for these processes. Windows can still assign different processes to these cores. Setting processor affinity only affects the processes you choose by running them only on the assigned cores.

What is the CPU priority in Windows 10?

As explained above, there can be hundreds of processes or threads competing for CPU time at any time in Windows 10. To ensure that critical processes and threads get priority access to CPU resources, the Windows schedule assigns priority to each process and thread on the operating system running.

For example, the Windows scheduling algorithm gives critical Windows processes such as System and Windows Explorer a high priority. When these processes are in a queue, they get access to the CPU before lower priority processes.

Related: Windows Task Manager Processes You Should Never Kill

So if you manually set a process's CPU priority to high, the Windows schedule ensures that the process gets priority access to CPU resources.

After all, CPU priority is very different from processor affinity. If setting a process's CPU priority tells the schedule how to handle that process, setting processor affinity locks a process on specific CPU cores. When processor affinity is set, even if the process is high or low priority, it will run on specific cores.

Why you want to assign programs to specific CPU cores

One of the biggest problems modern computing faces is large numbers of single-threaded programs. Even in 2021, when most processors are quad-core or higher, some programs will only use one of the many cores available.

Related: Intel Core i3 vs. i5 vs. i7: Which CPU Should You Buy?

This poses a problem for modern OS schedulers: How do you schedule single-thread processes on multi-thread processors without compromising compatibility?

Modern schedulers usually efficiently plan single-thread processes on modern CPUs. But there are times when a legacy program breaks due to poor compatibility. Setting the processor affinity can help here.

Processor affinity limits processes to run on the specified CPU cores. With older single-threaded programs, you can restrict such processes to one CPU core by specifying the processor affinity.

Apart from that, people with weaker machines can also benefit from giving their important tasks a high priority. For example, if you are a video editor, you can prioritize your rendering program before starting a video rendering. This way, when you want to render a video, Windows knows it is paying most of its attention to browsing your video.

How to set CPU affinity and CPU priority

To set processor affinity and priority, you need to open Task Manager and proceed from there.

So open the Task Manager by right-clicking on the Windows 10 taskbar and selecting Task manager. Then navigate to the process that you want to set affinity for.

Then right click on that process and select Go to the details.

The process you selected will be highlighted in the new window that opens. Right click on the highlighted process and select Set affinity. The Processor Affinity panel is now displayed.

In the Processor Affinity panel, deactivate the CPU cores on which the process should not be executed. Then click on OK. The processor affinity will now be set and the process you have chosen will only run on the selected CPU cores.

To set the CPU priority, right click on any process in the Task Manager and select Go to the details.

Then right-click the highlighted process and click Set priority.

Now select the priority from the list that appears. If you want your process to run as quickly as necessary, choose Real time.

However choose Real time causes other, possibly critical system processes to wait in the queue. In the mildest case this can lead to a general system slowdown and in the worst case to a complete system failure. So be careful when putting a process on real-time priority.

High Priority, on the other hand, is safer to choose as long as you don't prioritize too many processes.

The other options on the list, namely About normal, normal, Below normal, and Low, are self-explanatory.

Don't set processor affinity and CPU priority unless you know what you're doing

You should only set processor affinity and priority if you know what you are doing. The increase in performance, while significant in some cases, is not worth the trouble that can arise when something goes wrong. From slowdowns to random system crashes, setting affinity and priority should only be your last option.

Processor affinity and CPU priority aren't the only ways to increase Windows 10 performance. There are a variety of hardware and software tricks that you can use to get some performance out of your aging hardware.

14 ways to make Windows 10 faster and improve performance

It's not hard to make Windows 10 faster. Here are several methods to improve Windows 10 speed and performance.

Continue reading

About the author

Fawad Murtaza
(60 published articles)

Fawad is a full-time freelance writer. He loves technology and food. When he's not eating or typing on Windows, he's either playing video games or dreaming of traveling.

More
By Fawad Murtaza

Subscribe to our newsletter

Subscribe to our newsletter for tech tips, reviews, free e-books, and exclusive offers!

Click here to subscribe

Leave a Reply

Your email address will not be published. Required fields are marked *