In a .Net process, there is only one managed thread pool. We can set the minimum and maximum thread count as needed via public properties.
In .Net, we also have
Parallel.ForEach that gets its threads from this managed thread pool under the hood.
Parallel.ForEach we can also set the
MaxDegreeOfParallelism to limit the maximum number of threads.
I have two
Parallel.ForEach running in parrallel. One has
MaxDegreeOfParallelism set to 3 and the other has set to 7.
My question is: Does both my
Parallel.ForEach loops use the same thread pool under the hood. If yes, how does
Parallel.ForEach limits the threads with
MaxDegreeOfParallelism. How multiple
Parallel.ForEach loops and one managed thread pool work together?
It'll really help if you can provide a high level explanation or some pointers before I peak into the .net core source code.