Cpu affinity windows 2012

What is Processor Affinity & how to set Processor Affinity on Windows 10

When a Program runs in Windows 10, it uses CPU. Most of the computers have a multicore processor. Any Program that you run uses all the CPU cores. In simple words, Windows OS decides how to use the cores for any program. That said, it is possible to set programs to use only one or two core instead of all cores. In this post, we will explain what is Processor Affinity and how to set Processor Affinity for any program in Windows 10.

What is Processor Affinity in Windows 10

Processor Affinity also called CPU pinning, allows the user to assign a process to use only a few cores. Technically you can bind and unbind a process or thread to CPU or CPUs which here can be termed as CPU cores. But the real question is why is such an option available, and is there an advantage of setting processor affinity.

Processor Affinity is useful if you have a heavy program like video rendering. When you dedicated a core for the video editing program, it ensures that the core of the processor is always dedicated to the task. It improves performance because it reduces reduce cache problem as there is no delay with a dedicated core.

However, this also means that the program cannot use any other core which affects load balancing.

Usually, Windows 10 balances pressure on a CPU by distributing multiple threads to multiple processor cores. So unless you are sure what you are doing, we would highly recommend you to let things run on default settings.

How to set Process Affinity in Windows 10

In Windows 10, an administrative user can specify which cores a process can use every time it is launched. Here is how to set it up.

  1. Right-click on the taskbar.
  2. Click on the Task Manager option.
  3. In the Task Manager, switch to the Details tab. It will show a list of running programs.
  4. Right-click on the program for which you want to set process affinity.
  5. Choose Set affinity from the menu.
  6. It will open the Processor affinity window.
  7. Choose which core the process can use, and deselect the rest of them
  8. Click OK to complete the task.

Once done, your program will not only use that CPU core.

I would recommend you to keep an eye on how the program performs if the program slows down, its best to assign more cores to use all the cores.

Processor Affinity in Windows 10 should be used by pro users. Change it only if you know what and why you are doing it.

Setting Processor Affinity in Windows

One feature that has been available in Windows for a long time now has been setting processor affinity for your applications. However, not a lot of users know about it because quite frankly, it’s not really needed at all! Setting processor affinity allows you to adjust the amount and specifically which CPU cores an application can use. If you have a dual core CPU, that means you have two logical processors within a single physical CPU chip. If you have a quad-core CPU, then you have four logical processors within a single physical CPU chip. An application designed to take advantage of these extra cores obviously runs faster and allows you to complete tasks much faster. Just recently, a good friend needed a way to manually convert his huge DVD library into a much more compact file that can be played on his tablet. Each of his DVD consists of about four 1GB VOB files. Technically, he could just ram those files onto a SD card and call it a day but his DVD collection is huge. Therefore, it wasn’t efficient. So we then had to find the best way possible to convert those video files into a much smaller size and more importantly, retain as much quality as possible. We tried various conversion formats via Format Factory, one of my favorite conversion utility, but my friend wasn’t satisfied. He wanted the conversion to be more faster and retain more quality. I then tried out Handbrake and it was perfect. However, there was just one problem. This utility really puts a work on your CPU and with that comes extreme heating issues.

Читайте также:  Удаленное отключение сервера linux

Handbrake is one of the more popular conversion utilities out there to help users convert their video files into a compatible format for their Apple devices (iPhone, iPad, iPod). However, its not just for users with Apple devices. Many tablets and similar devices like to support the .MP4 video format and so a video converted within Handbrake will play on Apple devices as well as any other device that supports the format. What I like about Handbrake is that it is very fast in conversion, especially when encoding via H.264. This is so because Handbrake will just squeeze the life out of your CPU! It will maximize all cores of your CPU. The beauty of this is that your conversion job will finish faster than other conversion utilities that isn’t designed to take advantage of the multiple cores in your CPU. The bad news is that maximizing your CPU will increase the temperature. If you have a lot of files to convert or if you have a very large video file, having your CPU temperature so high for long periods might not be a good thing down the road depending on how you look at it. Well, my friend thinks this is a problem. You’re probably now thinking if my friend can get any more irritating! True, but my job is to advise and improvise on the spot and since he didn’t want to overwork his CPU to death, I had to come up with another solution.

A Note Before We Begin…

As I mentioned earlier, there is a good chance that you may have never heard of setting processor affinity. This is fine because you normally wouldn’t have to worry about this. Your operating system, Windows in my case here, would usually take care of allocating resources to your different applications. In fact, that is one of the main purposes of an OS. It’s a platform for you to launch your applications and programs and then helps you automatically maintain the resources to keep the application up and running. Whether its CPU, memory, network or hard disk resources, the operating system will take care of it for you. In some very special scenarios, a user can choose how an application utilize processor resources. Typically, a system administrator will usually perform this sort of customization on heavy duty servers with multiple physical processors installed. This allows them to better dedicate specific CPU processors for mission critical applications. On a typical home computer or laptop, although a CPU can be very fast, the computer is still equipped with just one physical processor. It may have anywhere from 2 to 4 or even 6 logical cores within it but its still just one physical CPU chip. What is the meaning of all this? Honest be told, not much for the average user. I am just documenting this for users who have never heard of this feature before in Windows.

The Problem

Assigning processor affinity limits how many and which logical CPU cores an application can utilize. If you have multiple physical processors installed, then you can also control on which physical processor the application can utilize. Why is this important for my situation? Well, my friend’s awesome Dell laptop has a Intel Core i5 processor with four logical processors inside. When using Handbrake for video conversion, all four of the logical processors are maximized at 100%. This basically means that the physical processor itself is being worked full time for the duration of the conversion process. Because the CPU is being worked at 100% utilization until the video conversion is completed (which can take a while depending in your situation), this full workload causes the CPU temperature to rise. If you’re even remotely familiar with electronics, you will know that heat is generally the worst enemy for the innards of a computer system. As I explained this to my friend, he got really concerned. As you can see, I was in a dilemma. He needed the conversion process for a video file to be relatively fast yet he’s concerned about the heat issue. The only way to convert faster is to utilize all cores of his CPU. The higher and longer you utilize the CPU, the hotter it gets. The only solution I had was to make a slight compromise.

Читайте также:  Подключить мой диск истории файлов windows 10

I’m writing this blog post on my Intel dual-core CPU laptop. Therefore, I only have two logical CPU cores as opposed to four cores on my friend’s laptop. As far as the procedure goes for setting the processor affinity though, it is identical. Because his CPU is so much more powerful, our results differ.

In order to be able to compare how adjusting processor affinity can help in our situation, I need to monitor my internal CPU temperature before and after the change. There are a couple of free Windows utilities that will allow us to monitor our internal CPU temperature using different sensors. Be mindful that these utilities may not 100% accurately relay back CPU temperature information! Two such utilities include both Speedfan and Core Temp. I chose the latter.

OK so first I checked what my CPU idle temperature (all temperature readings are in Celsius format) was at prior to starting this simple experiment. My CPU hovered at around the low 40 degrees. Once I got this down, I then proceeded to perform the conversion on my laptop using both CPU cores. I allowed the conversion process to run for about 7 minutes straight and then I took the temperature reading of both cores. You can see the results below. The first picture is of task manager showing that both my CPU cores were being utilized 100%. The second picture shows Core Temp with the temperature readings of both CPU cores after the 7 minutes was up.

Full Workload Prior Temperature

Setting Processor Affinity

Now I’m going to set the process affinity for the Handbrake conversion process so that it can only use CPU #0. First I have to head over to Task Manager. You can easily do this by pressing the keyboard combination of Ctrl+Shift+Esc. If you are using either Windows XP or Windows 7, head over to the Processes tab. If you are using the Windows 8 Release Preview like I am doing here, you have to head over to the Details tab instead.

Details Tab

Next I’ll have to select the actual process to set the affinity on. In my scenario, it is the HandBrakeCLI.exe process. Right-click on the process and select the Set Affinity option.

Set Affinity

Finally, in the Processor Affinity window, deselect the cores that you do not want the selected process to utilize. In my case, I will uncheck CPU #1.

Processor Affinity

The Results

Once I have the process configured, it was only a matter of restarting the conversion process. Below, you can see another Task Manager screenshot but this time around, you can clearly see that only one of the cores is being utilized to its maximum potential. The other core is just being idle.

After waiting for another 7 minutes or so, I took another shot of Core Temp and here are the resulting temperatures:

I’m sure you will quickly come to the conclusion that there really isn’t that much of a difference between the temperatures when the conversion process was running on both cores and while running only on one. The current temperature between Core #0 (utilized) and Core #1 (idle) is only a couple of degrees off. I can assure you however, that there was a much bigger difference when I did a similar test on my friend’s much more powerful Dell laptop. At full load, using all four cores, the CPU rose up to around 85-88 degrees Celsius. Obviously it would continue to rise, slowly but surely, if left in that running state. Water boiling temperature is at 100 degree Celsius. Once we set the affinity so that it was only running on two cores, we saw a big dip in temperature to about the high 60’s mark. Once again though, the temperature would surely continue to rise if left in that running state for a long period of time but at least the temperature is a little under control. This works for my friend because he’s agreed to let the processor cool down a bit after converting 2-3 videos at a time. At four cores, a single 1GB VOB file was converted in only about 5 minutes or so. Using only two cores, the process took about 8-9 minutes.

Читайте также:  Windows для старого компьютера pentium 4

Having a processor run hot for long periods of time is never good. While you may not notice anything in the short term, it can slowly degrade the CPU reliability and stability over time. With advance technology at our disposal today, I’m sure this is less of an issue than before but it is still something to be concerned with. In fact, many businesses spend big bucks just to keep their servers running cool.

In the End…

I’ll repeat for the third time here that setting processor affinity for your applications is not something you need to concern yourself with! However, there are some useful cases for performing such a procedure. One that immediately comes to mind is helping an older legacy application continue to function on a multi-core processor when it was originally designed to be run on a single core system only. Setting processor affinity might be able to trick the application into thinking it is running in the ideal environment when it really isn’t.

If you find that your processor’s temperature is above what you think it should be in, then there are some things you can do. The simplest thing to do first is to just use Task Manager and see which processes are going bananas with CPU utilization. A constantly utilized CPU even though you aren’t doing anything on the system can either mean you have a lot of crapware running in the background or worst case, you have malware on your system.

A CPU gets cooled due to a combination of a heat sink and fan clamped on top of the CPU itself. The heat gets transferred to the metal heat sink while the fan on top of it cools it down. There is a special thermal compound that sits between the physical CPU and the heat sink. In rare cases, you’ll need to detach the heat sink and re-apply new thermal compound so that the heat can be better transferred. If you have high CPU temperature, you might also want to consider purchasing an after market heat sink and fan. The stock unit that comes with your computer might not be able to handle the rising temperature. Simply give Youtube a visit and you’ll find all sorts of instructional videos telling you of how to perform this procedure.

2 thoughts on “ Setting Processor Affinity in Windows ”

For all the laptop users out there it is a bit harder to upgrade your CPU cooler or impossible (depending on the laptop). The easiest way to help it stay cool is to make sure the vents are clear (blast it with compressed air) and make sure the vents are clear.

Sitting with the laptop on your lap with all the vents covered will kill your laptop quick quickly. You can also buy a laptop cooling pad I have one of these and it has helped with the temperature a lot.

Good advice although I have heard some pretty scary stories about cooling pad doing more harm than good. While it can help cool the laptop a bit more, it’s also blowing in more dust into the vents as a result so more cleaning will be required.

What my friend actually did was getting a couple of plastic leg tips. These are like water bottle caps and he just stuck four in each corner under his laptop to help raise it up from the table in hopes that heat will dissipate better. He said it worked for a bit and saw a little drop in heat.

Оцените статью