ConcurrentExclusiveSchedulerPair中的maxItemsPerTask有什么作用?
What is the effect of maxItemsPerTask in ConcurrentExclusiveSchedulerPair?
MSDN 将 ConcurrentExclusiveSchedulerPair
maxItemsPerTask
定义为
maxItemsPerTask
Type: System.Int32
The maximum number of tasks to process for each underlying scheduled task used by the pair.
https://msdn.microsoft.com/en-us/library/hh194750(v=vs.110).aspx.
但是我不明白这个定义。
如果我设置这个(例如 5
),实际会发生什么?
ConcurrentExclusiveSchedulerPair
将允许 creation of up to maxConcurrencyLevel
concurrent tasks(或单个独占任务)每个处理最多 maxItemsPerTask
个任务然后完成,或者如参考资料来源所解释的那样:
/// <summary>The maximum number of tasks we can process before recycling our runner tasks.</summary>
private readonly int m_maxItemsPerTask;
一个任务处理并发任务 can be stopped before reaching maxItemsPerTask
if there's an exclusive task waiting to be processed 而不是相反,因此 maxItemsPerTask
可用于限制独占任务以防止并发任务耗尽。
MSDN 将 ConcurrentExclusiveSchedulerPair
maxItemsPerTask
定义为
maxItemsPerTask
Type: System.Int32
The maximum number of tasks to process for each underlying scheduled task used by the pair.https://msdn.microsoft.com/en-us/library/hh194750(v=vs.110).aspx.
但是我不明白这个定义。
如果我设置这个(例如 5
),实际会发生什么?
ConcurrentExclusiveSchedulerPair
将允许 creation of up to maxConcurrencyLevel
concurrent tasks(或单个独占任务)每个处理最多 maxItemsPerTask
个任务然后完成,或者如参考资料来源所解释的那样:
/// <summary>The maximum number of tasks we can process before recycling our runner tasks.</summary>
private readonly int m_maxItemsPerTask;
一个任务处理并发任务 can be stopped before reaching maxItemsPerTask
if there's an exclusive task waiting to be processed 而不是相反,因此 maxItemsPerTask
可用于限制独占任务以防止并发任务耗尽。