Stupid question?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Carl Johansson

    Stupid question?

    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


  • Ben Voigt [C++ MVP]

    #2
    Re: automatic use of cores for different threads, was: Stupid question?

    Carl Johansson wrote:
    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).
    >
    Regards Carl Johansson

    Comment

    • Ignacio Machin ( .NET/ C# MVP )

      #3
      Re: Stupid question?

      On Nov 17, 11:23 am, "Carl Johansson"
      <carl.johans... @nogarbagehalld e.comwrote:
      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.

      Comment

      • =?ISO-8859-1?Q?Arne_Vajh=F8j?=

        #4
        Re: Stupid question?

        Carl Johansson wrote:
        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

        Comment

        • Tim Roberts

          #5
          Re: Stupid question?

          "Carl Johansson" <carl.johansson @nogarbagehalld e.comwrote:
          >
          >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.
          --
          Tim Roberts, timr@probo.com
          Providenza & Boekelheide, Inc.

          Comment

          • Carl Johansson

            #6
            Re: automatic use of cores for different threads, was: Stupid question?

            "Peter Duniho" <NpOeStPeAdM@nn owslpianmk.coms krev i meddelandet
            news:op.uktpjxm a8jd0ej@petes-computer.local. ..
            _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


            Comment

            • Ben Voigt [C++ MVP]

              #7
              Re: automatic use of cores for different threads, was: Stupid question?

              Peter Duniho wrote:
              On Wed, 19 Nov 2008 13:04:25 -0800, Carl Johansson
              <carl@forenamel astname.stwrote :
              >
              >[...] 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.


              Comment

              • Carl Johansson

                #8
                Re: automatic use of cores for different threads, was: Stupid question?

                Ok, you can stop hyperventilatin g, you win!

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

                Regards Carl Johansson

                "Peter Duniho" <NpOeStPeAdM@nn owslpianmk.coms krev i meddelandet
                news:op.ukv2mfe h8jd0ej@petes-computer.local. ..
                On Wed, 19 Nov 2008 13:04:25 -0800, Carl Johansson
                <carl@forenamel astname.stwrote :
                >
                >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...
                [...]

                Comment

                • Peter Duniho

                  #9
                  Re: automatic use of cores for different threads, was: Stupidquestion?

                  On Thu, 20 Nov 2008 04:16:27 -0800, Carl Johansson
                  <carl@forenamel astname.stwrote :
                  Ok, you can stop hyperventilatin g, you win!
                  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"?
                  Now, pretty please, with sugar on top, can we continue our focus on
                  computer
                  programming!?
                  We have always been willing to maintain that focus, being side-tracked
                  only when others such as yourself insist.

                  Pete

                  Comment

                  • Carl Johansson

                    #10
                    Re: automatic use of cores for different threads, was: Stupid question?

                    Please!

                    "Peter Duniho" <NpOeStPeAdM@nn owslpianmk.coms krev i meddelandet
                    news:op.ukw41sg 48jd0ej@petes-computer.local. ..
                    On Thu, 20 Nov 2008 04:16:27 -0800, Carl Johansson
                    <carl@forenamel astname.stwrote :
                    >
                    >Ok, you can stop hyperventilatin g, you win!
                    >
                    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"?
                    >
                    >Now, pretty please, with sugar on top, can we continue our focus on
                    >computer
                    >programming! ?
                    >
                    We have always been willing to maintain that focus, being side-tracked
                    only when others such as yourself insist.
                    >
                    Pete

                    Comment

                    Working...