-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Limit min threads in thread pool to 1 #14864
Conversation
@@ -617,7 +617,7 @@ BOOL ThreadpoolMgr::SetMinThreads(DWORD MinWorkerThreads, | |||
|
|||
if (GetForceMinWorkerThreadsValue() == 0) | |||
{ | |||
MinLimitTotalWorkerThreads = min(MinWorkerThreads, (DWORD)ThreadCounter::MaxPossibleCount); | |||
MinLimitTotalWorkerThreads = max(1, min(MinWorkerThreads, (DWORD)ThreadCounter::MaxPossibleCount)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this is how the .NET Framework behaves?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.NET Framework also allows 0 for the min thread count but would have the same issue. WorkerCounter's MaxWorking field is limited to this value on the low end and if it's allowed to become 0 through hill climbing thread adjustments, it triggers an assertion failure but also would require the starvation heuristic to kick in to pick up a work item. Marked for consideration for porting.
@dotnet-bot test Ubuntu armlb Cross Debug Innerloop Build (seg fault in JIT/Regression/CLR-x86-JIT/V1-M09.5-PDC/b28037/b28037/b28037.sh is not related to this change) |
* Add test for setting min worker threads in thread pool to 0 Related to https://github.com/dotnet/coreclr/issues/14239 Depends on dotnet/coreclr#14864 * Add a verification removed in #25144 * Address feedback
Commit migrated from dotnet/corefx@6e39d49
…orefx#25061) * Add test for setting min worker threads in thread pool to 0 Related to https://github.com/dotnet/coreclr/issues/14239 Depends on dotnet/coreclr#14864 * Add a verification removed in dotnet/corefx#25144 * Address feedback Commit migrated from dotnet/corefx@42720da
Related to https://github.com/dotnet/coreclr/issues/14239