Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

What exactly is Priority and Affinity (found within Task Manager) and what are they used for:

Found within Task Manager

In what situations should/could they be used and what advantages are found while customizing these setting.

share|improve this question
add comment

3 Answers 3

up vote 3 down vote accepted

Setting affinity does do something, but you'll never want to use it.

Setting the CPU affinity forces Windows to only use the CPU (or cores)'s selected. If you set the affinity to a single CPU, Windows will only run that application on that CPU, never on any others.

Windows automatically puts run applications on the least busy processor, so limiting it to a single CPU doesn't let Windows do it's job. Even if CPU/core 1 is busy running other applications, Windows won't be able to run an application with affinity set on CPU/Core 2.

Really the only reason you would want to do that is to run some old application that doesn't work correctly when running on a multi-CPU/Core system.

share|improve this answer
    
> you'll never want to use it. Not true. If you have a single-threaded application, then it cannot use the CPU’s threads/cores to their fullest extent and there is nothing that Windows can do to force/trick it to. If you have two single-threaded applications, you can tell Windows to have each one use a separate thread/core so that instead of having the total CPU usage hover around 50-75%, you can max it out to 100% (each core being used to the maximum by one program). So yes, you can indeed make use of the setting, but it is a specific scenario that most people won’t know/realize/need. –  Synetech Aug 11 '12 at 23:33
    
If you have two single threaded applications Windows will run each on a different thread/core and you'll get 100% CPU utilization without setting affinity. To test I just ran 4 instances of a single threaded program on my 4 core machine and got 100% CPU usage. Windows is smart enough to schedule CPU's efficiently. –  shf301 Aug 12 '12 at 1:37
    
I guess it depends on the system and/or version of Windows. I have seen it (XP) hover both cores at 50-75% where both processes were set to both cores and manually setting them maxed out the CPU. –  Synetech Aug 12 '12 at 2:57
    
@Synetech: That seems almost impossible. It would have to have been moving the two processes from core to core, always both at the same time. –  David Schwartz Mar 21 '13 at 15:52
add comment

Setting affinity tells that process what processors it's allowed to run on.

While very useful for some niche cases, the average user probably shouldn't mess with it.

For instance if a process were allowed its own core to run it could run in (near) real-time without those 70 windows utilities constantly interrupting and stack-swapping on the processor for their own time slice. Real-time applications were something that windows could never do before multi-processor/multi-core systems hit the scene because the OS would constantly be interrupting/task-switching the application for its own purposes. That can now mostly be overcome by isolating the real-time application one processor while preventing all the other applications in the system from using that processor. This is a very niche subject but systems like (real) flight simulators, factory automation, and control feedback systems depend on real-time architecture to work.

Processor intensive applications (like VMs) can be isolated to their own core so you can use them without bringing the rest of your system to a crawl. In theory, a hypervisor running on a processor that supports bare-metal hypervisor interaction can reach processor performance equal to independent OS running on its own (minus the processor needed to run the host OS). Of course, in practice even a VM running on its own isolated core/processor will still need to accept small amount of overhead from the host the host OS.

For applications that handle a large amount of data in flux, isolating the application to its own processor (and potentially still utilizing multiple cores) will cut down on cache swapping.

Older applications that break when they're spread across multiple processors can effectively be limited to one core/processor to fix the issue.

If you were doing performance measurements on a specific application, it's near impossible to get consistent results across different systems unless you can isolate the process because, otherwise, you have no control over how much time the OS gives your application. Most people agree that measuring runtime performance doesn't give good results but those people have never considered that the OS intervention (that makes results so inconsistent) can be limited by using affinity.

There are plenty of cases where affinity is vital but, if you don't know what they are, you probably won't need it.

share|improve this answer
add comment

Higher priority means that processing of a task will be advantaged over low-priority tasks. If you're running an application that you require to be very responsive, and a bunch of other non-interactive processes for example, priorities can make ensure a better experience with your high-priority process.

For example: since Windows Vista, Windows Media Player automatically gets a higher priority to ensure smooth and continuous playback of media files, with only about 20% of CPU time available to other processes by default. This is just an example to help you understand what priorities do. (You can read more about Media Player priorities in Vista on Technet.)

Soft or hard affinity can increase processing speed because the CPU's cache can still have remnants of the process in it when a process was previously interrupted and then resumed at a later time.

share|improve this answer
    
Sweet thanks! So what's a good guide to using afinity? –  KronoS Aug 27 '10 at 23:22
    
addictivetips.com/windows-tips/… –  Moab Feb 11 '11 at 1:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.