Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TPL - Difference between MaxDegreeOfParallelism and MaximumConcurrencyLevel

What's the difference between ParallelOptions.MaxDegreeOfParallelism and ParallelOptions.TaskScheduler.MaximumConcurrencyLevel? When would you use either?

like image 852
SFun28 Avatar asked Mar 08 '11 16:03

SFun28


People also ask

What is maxdegreeofparallelism in VB NET?

The MaxDegreeOfParallelism property affects the number of concurrent operations run by Parallel method calls that are passed this ParallelOptions instance. A positive property value limits the number of concurrent operations to the set value. If it is -1, there is no limit on the number of concurrently running operations.

What is MDOP and cost threshold for parallelism?

The Max Degree of Parallelism (MDop) simply defines the number of processors/cores that SQL Server will use when the optimizer determines parallelism is needed. The Cost Threshold for Parallelism is cost threshold of when the SQL Server will use parallelism.

What is cost threshold for parallelism in SQL Server?

The Cost Threshold for Parallelism is cost threshold of when the SQL Server will use parallelism. The cost is the overall cost the optimizer determines for each query and SQL Server will use parallelism if the cost is above the threshold value. The recommended settings for MDop is the number of cores not to exceed 8.

What is the difference between comprehensive and TPL insurance?

Unlike TPL, comprehensive insurance is not required by law. However, it actually provides more protection to a motorist. Not only does it cover you from third party accident costs, but it also protects you and your passengers from liabilities.


1 Answers

Using reflector, I've gathered that both are used in EffectiveMaxConcurrencyLevel property:

internal int EffectiveMaxConcurrencyLevel
{
    get
    {
        int maxDegreeOfParallelism = this.MaxDegreeOfParallelism;
        int maximumConcurrencyLevel = this.EffectiveTaskScheduler.MaximumConcurrencyLevel;
        if ((maximumConcurrencyLevel > 0) && (maximumConcurrencyLevel != 0x7fffffff))
        {
            maxDegreeOfParallelism = (maxDegreeOfParallelism == -1) ? maximumConcurrencyLevel : Math.Min(maximumConcurrencyLevel, maxDegreeOfParallelism);
        }
        return maxDegreeOfParallelism;
    }
}
like image 195
SFun28 Avatar answered Oct 30 '22 00:10

SFun28