Skip to content

Commit 3ebac29

Browse files
richlanderjkotasAntonLapounov
authored
Update Environment.ProcessorCount for containers (dotnet#6668)
* Update Environment.ProcessorCount for containers * Update xml/System/Environment.xml Co-authored-by: Jan Kotas <[email protected]> * Update xml/System/Environment.xml Co-authored-by: Jan Kotas <[email protected]> * Add remarks about processor count * Update xml/System/Environment.xml Co-authored-by: Anton Lapounov <[email protected]> * Update xml/System/Environment.xml * Update xml/System/Environment.xml * Update xml/System/Environment.xml Co-authored-by: Jan Kotas <[email protected]> * Update xml/System/Environment.xml Co-authored-by: Anton Lapounov <[email protected]> Co-authored-by: Jan Kotas <[email protected]> Co-authored-by: Anton Lapounov <[email protected]>
1 parent af01c0d commit 3ebac29

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

xml/System/Environment.xml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1753,13 +1753,20 @@ To identify the operating system platform, for example, Linux or Windows, you ca
17531753
<ReturnType>System.Int32</ReturnType>
17541754
</ReturnValue>
17551755
<Docs>
1756-
<summary>Gets the number of processors on the current machine.</summary>
1757-
<value>The 32-bit signed integer that specifies the number of processors on the current machine. There is no default. If the current machine contains multiple processor groups, this property returns the number of logical processors that are available for use by the common language runtime (CLR).</value>
1756+
<summary>Gets the number of processors available to the current process.</summary>
1757+
<value>The 32-bit signed integer that specifies the number of processors that are available.</value>
17581758
<remarks>
17591759
<format type="text/markdown"><![CDATA[
17601760
17611761
## Remarks
1762-
For more information about processor groups and logical processors, see [Processor Groups](/windows/win32/procthread/processor-groups).
1762+
On Linux and macOS systems for all .NET versions and on Windows systems starting with .NET 6, this API returns the minimum of:
1763+
- The number of logical processors on the machine.
1764+
- If the process is running with CPU affinity, the number of processors that the process is affinitized to.
1765+
- If the process is running with a CPU utilization limit, the CPU utilization limit rounded up to the next whole number.
1766+
1767+
The value returned by this API is fixed at .NET runtime startup for the process lifetime. It does not reflect changes in the environment settings while the process is running.
1768+
1769+
For more information about processor groups and logical processors, see [Processor Groups](/windows/win32/procthread/processor-groups).
17631770
17641771
## Examples
17651772
The following example demonstrates the <xref:System.Environment.ProcessorCount%2A> property.

0 commit comments

Comments
 (0)