What is the difference between CPU threads, OS threads, and app threads? Can multi-threaded apps run properly on single-core and single-threaded processors?

Reza Jaferi 331 Reputation points
2022-07-30T20:24:14.683+00:00

Hi,
To improve performance, I want to divide a part of my app into multiple threads and process them in parallel.
Assume that the user runs my app on an old system with a single-core processor. Do all of my app's threads work properly in this situation, or is only one thread executed?
Respond with sensitivity and offer documentation.
Thanks.

Developer technologies | .NET | .NET Runtime
Windows for business | Windows Client for IT Pros | Devices and deployment | Other
Developer technologies | Visual Studio | Testing
Developer technologies | XAML
Developer technologies | C#
0 comments No comments
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 78,006 Reputation points Volunteer Moderator
    2022-07-31T16:30:35.41+00:00

    Thread support is a feature of the hosting operating system. The operating system controls running the thread just like a process. If the hardware has multiple cores, the more than one thread can run at the same time.

    As there may be more threads and processes than cpu core, the operating system scheduler controls which ones runs. The scheduler use a cpu clock to know when to switch what code is actually running.

    As it has been easier to add cpu cores, rather than make the cpu faster, modern operating systems and compilers stress thread support to use the extra cpu cores.

    Threads are different than coroutines. Coroutines run on the same thread and are generally implemented by a library or compiler. In a coroutine, the routines yield to each other.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.