Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Dual-core CPUs and Multi-threading [modified]

Dual-core CPUs and Multi-threading [modified]

Scheduled Pinned Locked Moved The Lounge
asp-nethardwareperformancequestion
30 Posts 19 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Gary R Wheeler

    Based on comments from the device driver guy in my group, I wouldn't be surprised to see a lot of driver updates. Apparently it's pretty easy for a driver to assume a single processor environment and fail to take into account multiprocessor issues. This causes everything from performance problems to random BSOD's.

    John Simmons / outlaw programmer wrote:

    I'm running Win2K on the system in question

    I didn't think Win2K supported multiple processors out of the box. Or are you running a server version?


    Software Zen: delete this;

    Fold With Us![^]

    R Offline
    R Offline
    realJSOP
    wrote on last edited by
    #19

    Gary R. Wheeler wrote:

    I didn't think Win2K supported multiple processors out of the box. Or are you running a server version?

    I'm using Win2k Pro. If you go into device manager, expand the tree item "Computer", double-click the sub item, and click the 2nd tab, you'll see two items listed - Single CPU, and Mulitple CPU. All I had to do was click the multiple CPU option, and reboot.

    "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
    -----
    "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

    1 Reply Last reply
    0
    • D daniilzol

      Never had any problems with dual P3 config I had, but that was years ago. In any case, you can manually force affinity to one of the cores through task manager, shouldn't that fix the problem?

      R Offline
      R Offline
      realJSOP
      wrote on last edited by
      #20

      Yeah, but that's a pain. :)

      "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
      -----
      "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

      1 Reply Last reply
      0
      • D Dan Neely

        AIUI the updated driver's primary fix was to a power/noise conservation feature that could underclock the two cores independently causing timers to fall out of syncronization.

        R Offline
        R Offline
        realJSOP
        wrote on last edited by
        #21

        Yeah, that's what I've seen when I googled it. I'm turned off "Cool-n-Quiet", so maybe I won't have issues.

        "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
        -----
        "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

        D 1 Reply Last reply
        0
        • J John M Drescher

          John Simmons / outlaw programmer wrote:

          Now that I have a dual-core CPU, I was thinking about writing an app to compare the speed of using just one core versus using both cores to run a calculation-intensive thread. (It's fun to play with ne hardware.)

          If your calculation is not mutlithreaded the result is the dual core will probably be slower considering that it is probably clocked slower than the processor it replaces.

          John

          R Offline
          R Offline
          realJSOP
          wrote on last edited by
          #22

          Well, the new CPU is the same clock speed as the one it replaced (both are rated at 2.2ghz). What I wanted to do was create a calc thread, run that thread simultaneously on both cores, and then run two instances of the thread on the first core, and then on the 2nd core. I'm just curious to see what the results would be. I expect that dual core will be faster, followed by 2nd core, and then by first core.

          "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
          -----
          "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

          1 Reply Last reply
          0
          • R realJSOP

            Yeah, that's what I've seen when I googled it. I'm turned off "Cool-n-Quiet", so maybe I won't have issues.

            "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
            -----
            "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

            D Offline
            D Offline
            Dan Neely
            wrote on last edited by
            #23

            Same here, otoh My CPU's only not at 100% load during bootup and shutdown so it was probably a moot point.

            1 Reply Last reply
            0
            • M Mike Dimmick

              The OS allocates threads to logical processors, if they're runnable (not blocked or suspended), in order of priority. A thread will run for up to its quantum on any CPU on which it's allowed to run (you can set affinity to restrict a thread to specific logical processors) unless it's pre-empted by a higher priority thread. Windows boosts foreground apps by giving their threads a longer quantum than background apps. To take advantage of cache locality, Windows remembers which logical processor (logical HT core, physical core, physical processor) a thread last ran on, and a preferred logical processor for that thread. Each new thread in a process gets a different preferred processor from the previous one, rotating across the logical processors. If possible, it runs the thread on the last processor, or if that is not available, on the preferred processor. If neither are available it tries a nearby processor - another logical HT processor on the same core, another core in the same package, then other cores in the same memory domain (for Non-Uniform Memory Access [NUMA] systems), then finally any available core. The full details are in 'Windows Internals, 4th Edition' by Mark Russinovich and David Solomon. I'm hoping that Mark's SysInternals' acquisition by Microsoft doesn't get in the way of him updating this book!

              Stability. What an interesting concept. -- Chris Maunder

              S Offline
              S Offline
              Shog9 0
              wrote on last edited by
              #24

              Mike Dimmick wrote:

              If neither are available it tries a nearby processor - another logical HT processor on the same core, another core in the same package, then other cores in the same memory domain (for Non-Uniform Memory Access [NUMA] systems), then finally any available core.

              When did this kick in? I was thinking it was WinXP; i seem to remember Win2000 still having issues with seeing two HT processors as four actual processors and treating them accordingly... was this ever fixed?

              ---- Scripts i’ve known... CPhog 1.8.2 - make CP better. Forum Bookmark 0.2.5 - bookmark forum posts on Pensieve Print forum 0.1.2 - printer-friendly forums Expand all 1.0 - Expand all messages In-place Delete 1.0 - AJAX-style post delete Syntax 0.1 - Syntax highlighting for code blocks in the forums

              M 1 Reply Last reply
              0
              • R realJSOP

                When you have a dual core CPU, does a multi-threaded app "just know" that it can use the 2nd core, or can/must you set cpu affinity on a thread-by-thread basis in order to take advantage of the 2nd core? Now that I have a dual-core CPU, I was thinking about writing an app to compare the speed of using just one core versus using both cores to run a calculation-intensive thread. (It's fun to play with ne hardware.) -- modified at 8:33 Friday 4th August, 2006 (for spelling errors)

                "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                -----
                "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                A Offline
                A Offline
                Andy Brummer
                wrote on last edited by
                #25

                Open up task manager and add the thread column. Most of the applications already have multiple threads running, so windows is already swaping out all those threads even on single processor systems. Now it just has 2 processors to run hundreds of threads on instead of just 1. Like others have said, it manages all that for you. To take advantage of it in your software all you have to do is create multiple threads and syncronize the results. Figuring out how to keep a multiprocessor system at peak CPU utilization with a realistic workload is a hard thing to do as syncronization overhead usually takes a signifigant bite. So if you have a dual processor system with a single calculation, unless you can split it up to use 2 threads without a lot of syncronization you are only going to get single thread performance out of it.

                Using the GridView is like trying to explain to someone else how to move a third person's hands in order to tie your shoelaces for you. -Chris Maunder

                1 Reply Last reply
                0
                • S Shog9 0

                  Mike Dimmick wrote:

                  If neither are available it tries a nearby processor - another logical HT processor on the same core, another core in the same package, then other cores in the same memory domain (for Non-Uniform Memory Access [NUMA] systems), then finally any available core.

                  When did this kick in? I was thinking it was WinXP; i seem to remember Win2000 still having issues with seeing two HT processors as four actual processors and treating them accordingly... was this ever fixed?

                  ---- Scripts i’ve known... CPhog 1.8.2 - make CP better. Forum Bookmark 0.2.5 - bookmark forum posts on Pensieve Print forum 0.1.2 - printer-friendly forums Expand all 1.0 - Expand all messages In-place Delete 1.0 - AJAX-style post delete Syntax 0.1 - Syntax highlighting for code blocks in the forums

                  M Offline
                  M Offline
                  Mike Dimmick
                  wrote on last edited by
                  #26

                  I believe the HT thing was fixed in Windows XP; using a core/processor in the same memory domain was added in Windows Server 2003 (and XP x64, which uses the Server 2003 SP1 kernel).

                  Stability. What an interesting concept. -- Chris Maunder

                  1 Reply Last reply
                  0
                  • R realJSOP

                    When you have a dual core CPU, does a multi-threaded app "just know" that it can use the 2nd core, or can/must you set cpu affinity on a thread-by-thread basis in order to take advantage of the 2nd core? Now that I have a dual-core CPU, I was thinking about writing an app to compare the speed of using just one core versus using both cores to run a calculation-intensive thread. (It's fun to play with ne hardware.) -- modified at 8:33 Friday 4th August, 2006 (for spelling errors)

                    "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                    -----
                    "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                    M Offline
                    M Offline
                    Michael Dunn
                    wrote on last edited by
                    #27

                    You can set CPU affinity for a thread with SetThreadAffinityMask() but as others have said, in normal situations (ie, not benchmarking) it's better to let the OS thread scheduler handle it.

                    --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

                    1 Reply Last reply
                    0
                    • G Gary R Wheeler

                      Based on comments from the device driver guy in my group, I wouldn't be surprised to see a lot of driver updates. Apparently it's pretty easy for a driver to assume a single processor environment and fail to take into account multiprocessor issues. This causes everything from performance problems to random BSOD's.

                      John Simmons / outlaw programmer wrote:

                      I'm running Win2K on the system in question

                      I didn't think Win2K supported multiple processors out of the box. Or are you running a server version?


                      Software Zen: delete this;

                      Fold With Us![^]

                      D Offline
                      D Offline
                      David Patrick
                      wrote on last edited by
                      #28

                      My first, and last, dual processor was a dual P2-400 box ... it was running NT 4.0 ... and used to BSOD all the time due the video drivers. NT 4.0 supported dual processor out of the box .. it's just if you upgraded from single to dual processor you had to re-install a different kernel. Yeah, those were the days ... dual-processor was hard-core back then .. now a days, it dont mean a thing :-(

                      Rocket science is more fun when you actually have rockets - US Navy ad

                      1 Reply Last reply
                      0
                      • D dandy72

                        > Apparently there are "issues" with multiple cores under Windows with several apps (mostly games The only problem I've seen with a game when I swapped my Athlon64 3200 with a 4800 was GTA San Andreas. The timing was *way* off, eg, the in-game clock and traffic moved as fast as the machine could make it (which was interesting in its own right) :-D My quick solution was to reinstall the game on top of itself (fortunately the installer was smart enough to realize it didn't actually have to transfer any files back from the media on the hard drive), so that took less than 30 seconds. I haven't encountered any other problem whatsoever, and I simply dropped the new CPU in without reinstalling anything. At some later point I stumbled upon AMD's newer driver and installed it, but I can't even comment whether that made any difference or not...

                        S Offline
                        S Offline
                        shigris
                        wrote on last edited by
                        #29

                        Dual core appears to the OS as dual CPU, there is a procedure for changing the OS setting to support this feature (unless it was installed on a dual cpu or HT system with HT enabled), but the best way is to re-instyall the OS. Any way the application should work well without special regard accept writing the code in threades (and not to many opening and closing) and using sync features such as mutex and semaphores. Good luck:-D NS

                        1 Reply Last reply
                        0
                        • R realJSOP

                          Don't get too envious yet. Apparently there are "issues" with multiple cores under Windows with several apps (mostly games, but I don't own any of the ones I've seen mentioned), and this is such a problem that AMD has issued a new driver, and MS has issued a patch to address it. I'm running Win2K on the system in question, and I haven't noticed any problems (yet), but if I do, I haven't found anything about whether or not the driver/patch combo will work on Win2K. I'm not sure what I need to do about it yet, either. -- modified at 8:31 Friday 4th August, 2006

                          "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                          -----
                          "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                          S Offline
                          S Offline
                          Siderite Zaqwedex
                          wrote on last edited by
                          #30

                          The important thing is that they will fix it. So let's not linger on the software issue and just build 10xcore CPUs faster! :D

                          ---------- Siderite

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups