Re: Forcing a thread to use a specific processor?



I don't actually have any information on how well this is done. In addition, there is
another consideration in Vista, which is in a NUMA multiprocessor, there are ways of
causing the thread to migrate to the processor whose local memory holds the thread's data,
but I've not had time to experiment with these yet. However, these change the picture
somewhat for Vista, which may not use an available processor if it is not the local
processor for the thread. I just have no data on this.
joe
On Wed, 11 Jul 2007 07:11:50 -0500, "Peter Olcott" <NoSpam@xxxxxxxxxxxxx> wrote:

How smart is Windows XP or Vista at load balancing?

"Joseph M. Newcomer" <newcomer@xxxxxxxxxxxx> wrote in
message news:30n893lt1n8dhfg20qbuevaim00dqbhdg3@xxxxxxxxxx
No. You can only say that your threads can only run on a
set of processors; within that
allowable set, the scheduler is free to run any thread on
any processor, and that thread
will compete with other threads for the CPU cycles. In
particular, kernel threads will
almost always preempt your threads when they have to run.
You can't prohibit other
threads from running (although you CAN boost the priority
of your thread to make it less
likely that some other thread will run, but the Balance
Set Manager is going to
occasionally boost some random thread to priority 15 and
it will then compete with your
threads.
joe

On Tue, 10 Jul 2007 21:14:27 -0500, "Peter Olcott"
<NoSpam@xxxxxxxxxxxxx> wrote:


"Joseph M. Newcomer" <newcomer@xxxxxxxxxxxx> wrote in
message news:dp1793htedjrlmjqtc2tlecgnrodouipcg@xxxxxxxxxx
SetThreadAffinityMask. You can check this out with my
Thread Affinity Explorer that you
can download from my MVP Tips site.

Generally, binding a thread to a particular processor
will
overall result in poorer
performance than if you just let the scheduler choose
the
processor, because it means that
it will be forced to wait if that processor is busy,
even
if other processors are idle.

One technique that is used to improve user
responsiveness
(as opposed to program
performance or system performance) is to allow the main
GUI thread to run on any
processor, but the worker threads to run on any
processor
but procesor 0 (the low-order
bit of the mask), and then boost the priority of the
worker threads. This will cause the
scheduler to favor your threads, but not make the GUI
sluggish, because the GUI (and other
normal threads) will compete for CPU0 while the worker
threads consume CPU1..n.
joe


That sounds like good advice. Is there any way that I can
dedicate one processor to the exclusive use of one or more
of my threads?

On Mon, 9 Jul 2007 22:18:59 -0500, "Peter Olcott"
<NoSpam@xxxxxxxxxxxxx> wrote:

Now that we have dual core and quad core processors is
there
an easy way to force a thread to use a particular one of
these core processors in Windows XP or Vista?

Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm

Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm

Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: Forcing a thread to use a specific processor?
    ... but the worker threads to run on any processor ... scheduler to favor your threads, but not make the GUI ... MVP Tips: http://www.flounder.com/mvp_tips.htm ...
    (microsoft.public.vc.mfc)
  • Re: Forcing a thread to use a specific processor?
    ... and then boost the priority of the worker threads. ... scheduler to favor your threads, but not make the GUI sluggish, because the GUI (and other ... MVP Tips: http://www.flounder.com/mvp_tips.htm ...
    (microsoft.public.vc.mfc)
  • Re: Forcing a thread to use a specific processor?
    ... allowable set, the scheduler is free to run any thread on any processor, and that thread ... but the worker threads to run on any processor ... but not make the GUI ... MVP Tips: http://www.flounder.com/mvp_tips.htm ...
    (microsoft.public.vc.mfc)
  • Re: Is anybody else disgusted about the piece of junk called Micro
    ... Word MVP FAQ site: http://word.mvps.org ... Windows Explorer in Vista, and its integration into the Office 2007 file ... the IntelliPoint and IntelliType drivers for mouse & ... I've tried several times to upgrade my C: ...
    (microsoft.public.word.docmanagement)
  • Re: Is anybody else disgusted about the piece of junk called Micro
    ... Maybe that's why some folks say they were "conned" into switching to Vista. ... Herb Tyson MS MVP ... the IntelliPoint and IntelliType drivers for mouse & ...
    (microsoft.public.word.docmanagement)

Loading