Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 101795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:50:24+00:00 2026-05-11T00:50:24+00:00

I have some questions about multi-threaded programming and multi-core usage. In particular I’m wondering

  • 0

I have some questions about multi-threaded programming and multi-core usage.

In particular I’m wondering how the operating system and/or framework (this is .NET) deals with cores that are heavily used.

Here’s my questions regarding threads:

  • When a new thread is spawned, what is the algorithm for assigning the thread to a particular core?
    1. Round-robin type of algorithm
    2. Random
    3. The currently least used core
  • If not the currently least used core, would this type of code that determined this dwarf the typical use of a thread and thus just make matters worse?
  • Are threads moved from one core to another during their lifetime? If so, is this to handle cores that for some reason gets ‘overused’ and thus the operating system try to shuffle threads over to less used cores to help the system? If not, again, why not?

My final question, which is basically a reuse of the above, is about the .NET ThreadPool class, which handles things like .BeginInvoke and such. Does this class do any of this stuff? If not, why not, or should it?

Is there any way to tweak this handling, sort of hint at the operating system that this particular thread, please pay a bit more attention to it when you assign it a core, since I know it will use a lot of cpu. Would that make sense? Or would ‘a lot of cpu’ just be relative and thus not really good enough?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T00:50:24+00:00Added an answer on May 11, 2026 at 12:50 am

    When a new thread is spawned, what is the algorithm for assigning the thread to a particular core?

    That depends entirely on the OS. And the answer is usually a heavily modified round-robin scheme. Every x milliseconds, a core is interrupted, and a new thread placed on it (so there is no ‘least used core’. As long as there are threads ready to run, every core will have something to do).

    In Windows, I believe the highest-prioritized thread/process is always selected for execution. (So if you have one process running at high priority on a single-core system, that process will potentially run 100% of the time, starving out every other process. Of course this only applies if that process never blocks, which is unlikely in the real world.

    And of course, because a modern OS such as Windows is complex, there’s a lot more to it. Certain processes are given preferential treatment from time to time, but as a rule of thumb, Windows will always pick high-priority processes (which is why you could pretty much freeze your computer by giving a process ‘realtime’ priority back in the singlecore days)

    Under Linux, lower-prioritized processes are regularly scheduled as well, just not as often.

    But the best you can do is typically just assume that the OS will work out a fair scheme, and then try to play nice with the rest of the system. (Yield/block/sleep when you have nothing to do, allowing other threads to run).

    Are threads moved from one core to another during their lifetime?

    Of course. Imagine you have three threads running on a dualcore system. Show me a fair schedule that doesn’t involve regularly moving threads between cores.

    My final question, which is basically a reuse of the above, is about the .NET ThreadPool class, which handles things like .BeginInvoke and such. Does this class do any of this stuff? If not, why not, or should it? What stuff? Thread scheduling and choosing cores to run on? No, the threadpool is simply a mechanism to reuse threads for muliple tasks, instead of having to create a new thread for every single task, and then closing it afterwards.

    Is there any way to tweak this handling, sort of hint at the operating system that this particular thread

    That’s what thread/process priority is for. If you have a thread that must get lots of CPU time, even when there are other CPU-intensive threads running, raise the thread’s priority. But handle with care. Usually, there aren’t many CPU-intensive threads running, which means that even at normal priority, you’ll get 99.9% of the CPU time. As I said, Windows schedules higher-prioritized threads very aggressively, so only raise priority if you really mean it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 118k
  • Answers 118k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I'm going to echo everyone else, but I'll just encourage… May 11, 2026 at 11:39 pm
  • Editorial Team
    Editorial Team added an answer The conditional operator in C++ can return an lvalue, whereas… May 11, 2026 at 11:39 pm
  • Editorial Team
    Editorial Team added an answer As of OS 3.0 the Navigation Controller has a tool… May 11, 2026 at 11:39 pm

Related Questions

I have some questions about multi-threaded programming and multi-core usage. In particular I'm wondering
I have been trying to learn multi-threaded programming in C# and I am confused
When I was learning Java coming from a background of some 20 years of
I have worked on single threaded business logic/back-end programming for most of my career.
I've been reading a lot about asynchronous programming recently, as I need to create

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.