Processor Affinity, what it is and why it you should know how to make it
work.
Do you have a Core 2 Duo or Quad processor in your computer? Did you know
that you can make a program run on one processor instead of all of them? In the
computing world assigning a program or process scheduling to one processor is known as
affinity.
How it works: When you start your computer all programs
and processes are running on all available processors, if your system has two or
more
then the processors will 'share' the work load. This is not always the most
efferent use of the processors, because the scheduling of the processes by the
Operating System is not always the most efferent. By using the Task Manager you
can see which processor is getting most of the work load. In my experience and
experimentation I have found that in a dual processor system the first processor
(the '0' processor) will have the heaviest work load. The skewing of the work
load can be brought closer to equal with manual manipulation or with a program
that is designed to set the Affinity (process scheduling) when the computer is
started.
Case in point:
When you
start your computer after all the services and your normal everyday programs are
running, open the task manager. Go to the performance tab, you need to see
all of the processors, if you only see one 'CPU usage History' window
select 'View' then "One graph per CPU'. Now you can see the usage of each cpu in
your computer. Which one has the highest work load?
Next go to the Processes view, Look at the column for the CPU,
this is the time the cpu is being used, in the left hand column is the 'Image
name' this is the actual process that is running on the cpu. (Also check the box
'show processes for all users'). If you have a process that is using over 25% of
the cpu time right click on the process and look at which cpu's it is scheduled
to run on, more than likely it will be all the processors. At this time you can
change the affinity of the process to one processor, this means the process will
only be scheduled on that processor. Think about this for a minute, if you have
five programs that are getting 50% of the scheduled cpu time, then this one is
getting 25% of the cpu time this leaves 25% for all the other processes. Ideally
you would want to have any processes that do not require a lot of scheduled
process time to be on one processor. These processes are your services, small
programs like notepad, and any explorer windows you have open for access to
documents. Programs like your email, word processors, especially spreadsheet or
data base programs should be on one of the other processors. Microsoft SQL
(Sequel) Server is recommended to run on one or more processor by itself!
CPU History Graph.
CPU Time usage and Image Name.
Check the affinity. Both processors are being used.
Set one processor for scheduling this process.
The problem:
When you set the
process affinity the problem is that when you restart the computer all the
processes will revert back to the normal inefficient Operating System
scheduling.
You could intervene
and set the affinity of each process manually every time you start your
computer. Or you can get a program that you can direct each program or service
to be scheduled on a certain processor when the Operating System loads it. These
programs are very useful for moving the work load off of all the processor to
one specific processor every time the Operating System loads it.
Once you have determined which processor will get the services
and programs that use the least cpu scheduling you can put the hog programs on
the other cpu(s). I currently run all my services and low cpu scheduled
processes on my '0' cpu, my email, word processor, html editor, IE, and any
other program I use frequently on the '1' cpu. I do not have any lag time when
the Anti-virus program runs. I can also run my Defrag program in the back ground
with out a performance hit on any of my daily use programs. If I let the
Operating System do the processor scheduling (affinity) then the system would
drag from time to time while the Anti-virus or defrag program had the cpu time.
Here are a couple of Affinity programs I have found,
unfortunately you will have to search for them because the links are now gone
from the pages where I downloaded them. As with any thing you download from the
internet SCAN it.
setaffinity.exe
As you can see in this screen shot how much more complex the
program is.
taskassign.exe No
services are displayed, thus you can not set their affinity.
Setaffinity is the more complex program to use. Once
you set the affinity of the program or service you have to save it (one at a
time). It does how ever have the flexibility to create a file that will load on
startup and set the program affinity. This program requires an advance user to
setup and run, once you have your programs set then you are done.
TaskAssign does not see your services, it is good choice for the
novice computer user.
One more way to increase the
efficiency and optimization of your computer.
A newer version with more options (Free) is here: SetAffinity II
v1.035 (2008) Edgemeal Software
This site contains a lot of information. As
with any publication not all information is available due to space, time, or
subject constraints.
If you have a question that you did not find the answer
on this web site you a can
ask your question here and we will endeavor to get you the most up to date
answer possible!