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.

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,404 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,131 questions
Visual Studio Testing
Visual Studio Testing
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Testing: The act or process of applying tests as a means of analysis or diagnosis.
332 questions
XAML
XAML
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
772 questions
Windows Hardware Performance
Windows Hardware Performance
Windows: A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.Hardware Performance: Delivering / providing hardware or hardware systems or adjusting / adapting hardware or hardware systems.
1,557 questions
0 comments No comments
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 58,126 Reputation points
    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