Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Limit min threads in thread pool to 1 #14864

Merged
merged 1 commit into from
Nov 5, 2017
Merged

Conversation

kouvel
Copy link
Member

@kouvel kouvel commented Nov 4, 2017

@@ -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));
Copy link
Member

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?

Copy link
Member Author

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.

@kouvel
Copy link
Member Author

kouvel commented Nov 4, 2017

@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)

@kouvel kouvel merged commit 4be1b4b into dotnet:master Nov 5, 2017
@kouvel kouvel deleted the AssertFix branch November 5, 2017 02:01
kouvel added a commit to kouvel/corefx that referenced this pull request Nov 9, 2017
stephentoub pushed a commit to dotnet/corefx that referenced this pull request Nov 9, 2017
stephentoub pushed a commit to dotnet/corefx that referenced this pull request Nov 15, 2017
* 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
kouvel added a commit to kouvel/runtime that referenced this pull request Oct 20, 2020
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants