public sealed class ParallelEnvironment
Object
ParallelEnvironment
mscorlib
Parallel
Provides the current settings for, and information about, the parallel-loop execution environment.
System.Threading.Parallel Namespace
ParallelEnvironment Properties
ParallelEnvironment.MaxThreads Property
ParallelEnvironment.RecommendedMaxThreads Property
public static int MaxThreads { get; set; }
Default upper bound on the number of threads employed by a parallel loop.
A Int32 that limits the number of worker threads employed by parallel loop constructs that do not explicitly specify an upper bound on the number of threads. The bound includes the thread that calls System.Threading.Parallel.ParallelLoop<T>.BeginRun, and hence MaxThreads must be positive.
Setting System.Threading.Parallel.ParallelEnvironment.MaxThreads to 1 causes deterministic sequential execution of all parallel loop constructs that do not explicitly specify an upper bound on the number of threads. This is useful for debugging of code. Ordinarily, System.Threading.Parallel.ParallelEnvironment.MaxThreads should not be set in production code because it affects parallel loops everywhere in a program.The initial value is System.Threading.Parallel.ParallelEnvironment.RecommendedMaxThreads.
System.Threading.Parallel.ParallelEnvironment Class, System.Threading.Parallel Namespace
public static int RecommendedMaxThreads { get; }
Recommended value for System.Threading.Parallel.ParallelEnvironment.MaxThreads
A Int32 that is the initial value for System.Threading.Parallel.ParallelEnvironment.MaxThreads.
Values between 1x and 2x the number of physical threads on the platform are recommended.
System.Threading.Parallel.ParallelEnvironment Class, System.Threading.Parallel Namespace