Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista General Discussion > Set Affinity using command prompt?

Reply
Thread Tools Display Modes

Set Affinity using command prompt?

 
 
zachlr1@gmail.com
Guest
Posts: n/a

 
      12-21-2007
Is there a way to set a process affinity using command prompt? I
would like to make a .bat for setting all unimportant processes to
core 0, and all my games to both. And then to set all processes to
both cores when I am finished playing.
Also is this available on XP? My friend is looking to do the same
thing on XP.

Thanks,
Zach
 
Reply With Quote
 
 
 
 
PNutts
Guest
Posts: n/a

 
      12-22-2007
Hi Zach:

A quick Google
http://www.google.com/search?hl=en&q=vista+cpu+affinity

turned up

http://www.howtogeek.com/howto/windo...windows-vista/

which sounds like it might be what you want?



"" wrote:

> Is there a way to set a process affinity using command prompt? I
> would like to make a .bat for setting all unimportant processes to
> core 0, and all my games to both. And then to set all processes to
> both cores when I am finished playing.
> Also is this available on XP? My friend is looking to do the same
> thing on XP.
>
> Thanks,
> Zach
>

 
Reply With Quote
 
zachlr1@gmail.com
Guest
Posts: n/a

 
      12-22-2007
On Dec 21, 8:56 pm, PNutts <pnutterfi...@hotmail.com> wrote:
> Hi Zach:
>
> A quick Googlehttp://www.google.com/search?hl=en&q=vista+cpu+affinity
>
> turned up
>
> http://www.howtogeek.com/howto/windo...pplication-ass...
>
> which sounds like it might be what you want?
>
> "zach...@gmail.com" wrote:
> > Is there a way to set a process affinity using command prompt? I
> > would like to make a .bat for setting all unimportant processes to
> > core 0, and all my games to both. And then to set all processes to
> > both cores when I am finished playing.
> > Also is this available on XP? My friend is looking to do the same
> > thing on XP.

>
> > Thanks,
> > Zach




What I get from that is that you use that command to start a process
in a given affinity. Correct? However, I am looking to change the
affinity of a given process that is already running, and cannot be
restarted. This way, before I start a game, I can run the .bat file
to change all of the given processes to affinity on core 0, and games
on core 1. Then change back to normal once I am finished. I know
that you can do this with task manager and right clicking each
individual process, but this is very time consuming and inconvenient.
I say command prompt because I thought of automating it with a .bat
file, but if you know of any other (free) programs that deal with
affinity, please let me know.
 
Reply With Quote
 
Andrew McLaren
Guest
Posts: n/a

 
      12-22-2007
<> wrote ...
> What I get from that is that you use that command to start a process
> in a given affinity. Correct? However, I am looking to change the
> affinity of a given process that is already running, and cannot be


You can change the affinity using the GUI, ie Task Manager. Select the
Processes tab, highlight the process you want, right-click, and choose
"Affinity" from the context menu. This lets you change the affinity of the
running process.

There is no command-line tool to perform the same operation. You might be
able to do it with WMI Scripting.

Affinity is widely misunderstood. If your goal is to get better performance
for the game, you're probably wasting your time. Contrary to the simplistic
view, setting affinity does not generally improve performance. The unit of
scheduling in NT (including, here, Vista) is the Thread, not the Process. By
hard-binding a Process to a single CPU, you're actually lowering the chances
that the process's Threads will be scheduled to run. Besides, many or most
games are single-threaded anyway (they will only run on a single CPU, even
in multi-proc machines).

A couple of years ago I did a detailed performance analysis of a web
application (online banking) which a customer wanted to "optimise" it by
setting the affinity. After a week with Perfmon, the conclusion was that
there was no performance benefit whatever, and in fact a performance drop in
several scenarios, when a process is bound to a single CPU. The NT Scheduler
is pretty smart, and can be relied on to make good scheduling decisions in
most cases. If you have a performance bottleneck, it won't be because your
game is being starved for CPU. Or if it is, just close down the other
running processes before you start the game - that will be the more relaible
and effective way to get more CPU.

The main benefit of setting affinity is to provide comptibility for apps
which don't run well on multi-proc machines; you can fool them into thinking
they are running on a single proc machine.

You could try increasing the Priority of the game, so that it gets scheduled
to run at a higher probability - but again, the nett effect of this is often
less than obvious, and in most interactive applications, doesn't provide a
tangible benefit.

--
Andrew McLaren
amclar (at) optusnet dot com dot au


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
No command prompt dheller02 Windows Vista General Discussion 2 03-17-2008 01:16 AM
Re: Help please regarding Command Prompt Ronnie Vernon MVP Windows Vista General Discussion 0 03-12-2008 06:29 PM
Re: Help please regarding Command Prompt Rich Windows Vista General Discussion 0 03-12-2008 02:30 PM
Command Prompt Redcow Windows Vista General Discussion 4 03-03-2007 07:27 AM
Command Prompt Here Brad Palmer Windows Vista General Discussion 4 02-20-2007 02:17 AM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59