Stupid question?

C

Carl Johansson

If a multithreaded .NET application is executed on a computer with a
multicore processor. Will the application automatically run the threads on
different processor cores?

Regards Carl Johansson
 
B

Ben Voigt [C++ MVP]

Carl said:
If a multithreaded .NET application is executed on a computer with a
multicore processor. Will the application automatically run the
threads on different processor cores?

The question is not stupid but the subject line is. Use a meaningful
subject line in the future.

And the answer is 'yes' (but not guaranteed to do so if the system is busy
with other programs).
 
I

Ignacio Machin ( .NET/ C# MVP )

If a multithreaded .NET application is executed on a computer with a
multicore processor. Will the application automatically run the threads on
different processor cores?

Regards Carl Johansson

Hi,

In theory that depends of the OS and in the case of .NET also of the
VM. It's the OS's schedule the one that select which process run
where. Potentially you can assure that the answer is yes, but it
depends of the other process running in the machine.
 
A

Arne Vajhøj

Carl said:
If a multithreaded .NET application is executed on a computer with a
multicore processor. Will the application automatically run the threads on
different processor cores?

Yes.

And you can prove it my making a simple "variable threaded"
code and show that it runs almost twice as fast with 2 threads
as with 1 thread.

Arne
 
T

Tim Roberts

Carl Johansson said:
If a multithreaded .NET application is executed on a computer with a
multicore processor. Will the application automatically run the threads on
different processor cores?

You've had 3 different replies here, and the correct response is more or
less a combination of them all.

The operating system maintains a big list of "ready to run" threads. When
any processor or core needs something to do, it picks the first thread in
that list (glossing over the details of priority and affinity).

Neither the system nor the processors care whether the threads are part of
one process or multiple processes. They're just threads. If your process
has 4 threads, and those 4 threads are the top 4 on the "ready-to-run"
list, then you'll own all 4 cores. If you have other processes running,
then you're probably sharing the cores with threads from those other
processes.
 
C

Carl Johansson

Thank you all for your replies! It was very interesting, useful and also
very pleasing to read!

Regards Carl Johansson

(A personal note to Ben Voigt: I apologise (to all of you) for my “stupid”
subject line. To be perfectly honest, it was nothing but a cheap trick to
capture attention, which you of course looked through. It really was a
stupid idea. Thank you for pointing it out. I won’t be doing it again.
However, I do believe it is common courtesy to use the word “please” when
you urge someone to do something. Otherwise it could be perceived as an
order. And since you are in no position to give me orders (formally and
ethically), I would have appreciated a “please”, i.e.: “Please use a
meaningful subject line in the future.”)
 
C

Carl Johansson

Peter Duniho said:
_We_ don't care so much whether you use an appropriate subject line, but
_you_ should care very much because posts with stupid subject lines often
just get ignored. There are also issues related to how your post makes
the best contribution to the community, in that it provides an
easily-searched item in an archive, but that's really secondary to your
own self-interest in having your question answered.

Using a search engine, such as "Google Groups", I guarantee that anyone
interested in threads and multicore processors will find my post, even
though the choice of subject line was unfitting.

I thought it was obvious that Ben's reply to my question as well as his
suggestion to use a meaningful subject line was very much appreciated.

I don't think of myself as overly sensitive. It's just that I was brought up
to use the word "please", regardless of context. Perhaps I'm getting old...
So, take the advice or leave it, but don't waste time getting offended by
the way it was given (and again, that's not a request; it's a suggestion
meant to help _you_).

Instead of using all those words ("and again, that's not a request; it's a
suggestion meant to help _you_"), I would simply have used the word
"please" to make the same point. That is: "So, please take the advice or
leave it, but please don't waste time getting offended by
the way it was given".

I'm sorry if I made you upset! Please let's focus on computer programming
from here on!

Regards Carl Johansson
 
B

Ben Voigt [C++ MVP]

Peter said:
[...] There are also issues related to how your post makes
the best contribution to the community, in that it provides an
easily-searched item in an archive, but that's really secondary to
your own self-interest in having your question answered.

Using a search engine, such as "Google Groups", I guarantee that
anyone interested in threads and multicore processors will find my
post, even though the choice of subject line was unfitting.

I'm not sure why you are choosing to debate a minor point, one I
clearly stated was secondary to your own self-interests. But since
you insist...

So when speaking to Carl, we'll include the following disclaimer at the top
of every post:

"Carl, if you want to fix your problem, please take the following actions:"

Then we can use the imperative throughout the rest of the message.
 
C

Carl Johansson

Ok, you can stop hyperventilating, you win!

Now, pretty please, with sugar on top, can we continue our focus on computer
programming!?

Regards Carl Johansson

Peter Duniho said:
Using a search engine, such as "Google Groups", I guarantee that anyone
interested in threads and multicore processors will find my post, even
though the choice of subject line was unfitting.

I'm not sure why you are choosing to debate a minor point, one I clearly
stated was secondary to your own self-interests. But since you insist...
[...]
 
C

Carl Johansson

Please!

Peter Duniho said:
For someone who is so concerned about being polite, you sure have an odd
habit of describing others in arbitrarily negative ways. Is that also a
consequence of how you were "brought up", or because you're "getting old"?


We have always been willing to maintain that focus, being side-tracked
only when others such as yourself insist.

Pete
 

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