-
Notifications
You must be signed in to change notification settings - Fork 6k
Document new threading settings #47575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@@ -31,6 +31,17 @@ This article details the settings you can use to configure threading in .NET. | |||
| **runtimeconfig.json** | N/A | N/A | | |||
| **Environment variable** | `COMPlus_Thread_AssignCpuGroups` or `DOTNET_Thread_AssignCpuGroups` | `0` - disabled<br/>`1` - enabled | | |||
|
|||
## Set the size of stack for VM-created threads |
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.
## Set the size of stack for VM-created threads | |
## Set the stack size for threads created by the .NET runtime |
I do not think we use "VM" in the official docs when referring to the runtime
|
||
- The default size of stack is dictated by VM and OS policies. | ||
- This setting allows overriding the default. | ||
- The specified size should be between 64 kB and 2 GB and a multiple of the natural allocation granularity of the OS. |
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.
a multiple of the natural allocation granularity of the OS
Can we align the size up in the implementation so that this does not need to be documented? I think it is only a problem on Windows. This should behave just like the stackSize argument for System.Threading.Thread
constructor where we do the same.
@@ -31,6 +31,17 @@ This article details the settings you can use to configure threading in .NET. | |||
| **runtimeconfig.json** | N/A | N/A | | |||
| **Environment variable** | `COMPlus_Thread_AssignCpuGroups` or `DOTNET_Thread_AssignCpuGroups` | `0` - disabled<br/>`1` - enabled | | |||
|
|||
## Set the size of stack for VM-created threads | |||
|
|||
- The default size of stack is dictated by VM and OS policies. |
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.
- The default size of stack is dictated by VM and OS policies. | |
- The default stack size is dictated by .NET and OS policies. The default stack size for .NET apps is 1.5MB on Windows and macOS, and 8MB on Linux. The default stack size when .NET runtime is hosted (e.g. COM components) is dictated by the hosting process. |
We can document the defaults while we are on it.
## Set the size of stack for VM-created threads | ||
|
||
- The default size of stack is dictated by VM and OS policies. | ||
- This setting allows overriding the default. |
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.
- This setting allows overriding the default. | |
- This setting allows overriding the default for threads created by .NET runtime. For example, threads created by [`System.Threading.Thread`](https://learn.microsoft.com/en-us/dotnet/api/system.threading.thread.-ctor) API. |
Added in dotnet/runtime#110455.
Internal previews