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. In Windows, all threads are not created equal! :)

In Windows, all threads are not created equal! :)

Scheduled Pinned Locked Moved The Lounge
c++asp-netcomoopquestion
7 Posts 6 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.
  • D Offline
    D Offline
    David ONeil
    wrote on last edited by
    #1

    Just split a big job into three main threads in Windows. The first of them took longer to run than the other two (on a 4 core processor). Unfortunately, I can't exactly qualify it without re-running the almost 8 hour jobs on my 3.2 GHz machine. But two of the threads completed about an hour or more before the first thread! The last two completed at roughly the same time, far before the first of them.

    Our Forgotten Astronomy | Object Oriented Programming with C++ | Wordle solver

    J D 0 L M 6 Replies Last reply
    0
    • D David ONeil

      Just split a big job into three main threads in Windows. The first of them took longer to run than the other two (on a 4 core processor). Unfortunately, I can't exactly qualify it without re-running the almost 8 hour jobs on my 3.2 GHz machine. But two of the threads completed about an hour or more before the first thread! The last two completed at roughly the same time, far before the first of them.

      Our Forgotten Astronomy | Object Oriented Programming with C++ | Wordle solver

      J Offline
      J Offline
      Jeremy Falcon
      wrote on last edited by
      #2

      Could be a ton of reasons why, but assuming it's the same code in all three threads, keep in mind there is such a thing as processor affinity and thread affinity. The whole concept of parallelism is a mirage. Computers are just so fast at context switching it seems that way, but this concept is why they have thread scheduling, etc. In _theory_ it's a lot like preemptive multitasking in Windows, but it's on a hardware level and thus much, much quicker with less crap in the way. But, even with a multi-core CPU, something's gotta manage what gets ran. At least that's how it was back in my multithreaded days before multi-core became the norm but hyperthreading was a thing. These days in JavaScript land, threads scare people. :laugh:

      Jeremy Falcon

      1 Reply Last reply
      0
      • D David ONeil

        Just split a big job into three main threads in Windows. The first of them took longer to run than the other two (on a 4 core processor). Unfortunately, I can't exactly qualify it without re-running the almost 8 hour jobs on my 3.2 GHz machine. But two of the threads completed about an hour or more before the first thread! The last two completed at roughly the same time, far before the first of them.

        Our Forgotten Astronomy | Object Oriented Programming with C++ | Wordle solver

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        Let us also not forget there's thousands of other threads running in Windows that your process has to share those four cores with.

        Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
        Dave Kreskowiak

        1 Reply Last reply
        0
        • D David ONeil

          Just split a big job into three main threads in Windows. The first of them took longer to run than the other two (on a 4 core processor). Unfortunately, I can't exactly qualify it without re-running the almost 8 hour jobs on my 3.2 GHz machine. But two of the threads completed about an hour or more before the first thread! The last two completed at roughly the same time, far before the first of them.

          Our Forgotten Astronomy | Object Oriented Programming with C++ | Wordle solver

          0 Offline
          0 Offline
          0x01AA
          wrote on last edited by
          #4

          Quote:

          into three main threads in Windows.

          1 Reply Last reply
          0
          • D David ONeil

            Just split a big job into three main threads in Windows. The first of them took longer to run than the other two (on a 4 core processor). Unfortunately, I can't exactly qualify it without re-running the almost 8 hour jobs on my 3.2 GHz machine. But two of the threads completed about an hour or more before the first thread! The last two completed at roughly the same time, far before the first of them.

            Our Forgotten Astronomy | Object Oriented Programming with C++ | Wordle solver

            0 Offline
            0 Offline
            0x01AA
            wrote on last edited by
            #5

            Quote:

            into three main threads in Windows.

            You like to say with that you created _three_ threads in your _one_ process? If yes, don't be surpriced about your measurements. My expercience with windows is: In case you like to gain full cpu, span the work over multiply processes, instead of multiply threads in one process ;)

            1 Reply Last reply
            0
            • D David ONeil

              Just split a big job into three main threads in Windows. The first of them took longer to run than the other two (on a 4 core processor). Unfortunately, I can't exactly qualify it without re-running the almost 8 hour jobs on my 3.2 GHz machine. But two of the threads completed about an hour or more before the first thread! The last two completed at roughly the same time, far before the first of them.

              Our Forgotten Astronomy | Object Oriented Programming with C++ | Wordle solver

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Every I/O is an interrupt.

              "Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I

              1 Reply Last reply
              0
              • D David ONeil

                Just split a big job into three main threads in Windows. The first of them took longer to run than the other two (on a 4 core processor). Unfortunately, I can't exactly qualify it without re-running the almost 8 hour jobs on my 3.2 GHz machine. But two of the threads completed about an hour or more before the first thread! The last two completed at roughly the same time, far before the first of them.

                Our Forgotten Astronomy | Object Oriented Programming with C++ | Wordle solver

                M Offline
                M Offline
                MSBassSinger
                wrote on last edited by
                #7

                Did you also set your priority among threads? Honestly, I find my best performance in C# using the Task Parallel Library[^], letting it decide threads versus tasks, priorities, etc.

                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