C# on multicore

P

Padu

Hi,

I'm a newbie to C# and I haven't dig into multi-threading in .net (I have
some experience with MT in delphi and c++).
Let's say I have one of these new pentium D multicore. If I start a program
that has 2 threads, will they execute each in a different core? Is there any
support in the language to control in which CPU a thread will execute?
In a more general sense, how .net uses multi-core/multi-cpu systems?

Cheers

Padu
 
M

Michael Nemtsev

Hello Padu,

use Process.ProcessorAffinity to set which CPU each tread need to use
or create thread pool for each processor

P> I'm a newbie to C# and I haven't dig into multi-threading in .net (I
P> have
P> some experience with MT in delphi and c++).
P> Let's say I have one of these new pentium D multicore. If I start a
P> program
P> that has 2 threads, will they execute each in a different core? Is
P> there any
P> support in the language to control in which CPU a thread will
P> execute?
P> In a more general sense, how .net uses multi-core/multi-cpu systems?

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
M

Michael Nemtsev

Hello Padu,

BTW, if you are starting you app in SMP box (2 CPU) you CLR start works in
server mode and its responsible for CPU thread management

P> I'm a newbie to C# and I haven't dig into multi-threading in .net (I
P> have
P> some experience with MT in delphi and c++).
P> Let's say I have one of these new pentium D multicore. If I start a
P> program
P> that has 2 threads, will they execute each in a different core? Is
P> there any
P> support in the language to control in which CPU a thread will
P> execute?
P> In a more general sense, how .net uses multi-core/multi-cpu systems?
P> Cheers
P>
P> Padu
P>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top