开发者

TPL - Difference between MaxDegreeOfParallelism and MaximumConcurrencyLevel

What's the difference开发者_如何学Go between ParallelOptions.MaxDegreeOfParallelism and ParallelOptions.TaskScheduler.MaximumConcurrencyLevel? When would you use either?


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;
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜