I would agree. Some months ago, I was actually preparing to do the same
thing (assigning threads to CPUs). I wrote all of the code to check the
number of CPUs, setup a realtime graph that shows the load for each
processor that's available (engineers love pretty graphs, espcially when
they move!), and was in the process of writing an algorithm to balance the
CPU load (at least for the threads in my app), when I noticed that the OS
does a reasonable job of balancing the load automatically.
I was actually happy to stop work on the balancing algorithm, because I was
having trouble getting my head around how to move an active thread from one
processor to another processor if the user started other CPU intensive apps
that I had no control over.
HTH
Lee
"AMercer" <AM*****@discussions.microsoft.com> wrote in message
news:1E**********************************@microsof t.com...
I don't think you have to do anything special to get what you want. If you
have two processors and you launch a second thread, windows will
efficiently
allocate threads to processers. It will do so if your 2-thread program is
all that is running or if your 2-thread program runs concurrently with
other
cpu hungry programs.
"kaiteriteri" wrote:
I have a time-consuming VB.net application that i'd like to thread over
2 processors (that's all i've got in my machine!) and, hopefully, get it
done in
half the time. On running, the application should create a 2nd thread and
run
it on the other processor (processing a distinct set of data), leaving
the
current
thread to run and process its set of data. But the 2nd thread must run on
the
free processor, otherwise there's no point...
Can someone point me towards a VB.net example that does this?
{I see mention elsewhere of Get/Set of AffinityMasks within Threads but
not
any examples of its usage for this type of thing, I believe this is the
property
that is used to force a specific processor to be used.}