How threading works in .NET
An application that is executed on a CPU with more than one core should benefit from concurrent execution, with as many concurrent tasks as there are logical cores to execute on. Of course, there are many questions that need to be taken care of when we want to execute parallel tasks:
- How to divide a set of tasks so that each of them is executed in a multicore environment?
- How to ensure that the number of concurrent tasks doesn't exceed the number of CPU cores?
- If some task is stopped, such as when you wait for I/O, how to discover this and make the CPU execute something else while waiting for I/O completion?
- How to find out when one or more parallel operations are completed?
When you use a framework, answers to these questions ...