Parallel.ForEach
uses a managed thread pool to schedule concurrent activities. The number of threads is set ThreadPool.SetMinThreads
and ThreadPool.SetMaxThreads
. By default, the minimum number of threads is set to the number of processors in the system.
, . , .
MaxDegreeOfParallelism
Parallel.For
. , , .
, Thread.Sleep(100000);
, .
ThreadPool.SetMinThreads(100, 100);
Parallel.ForEach
, 100
, .