Skip to content

Multigroup affinities - Update usermode affinity API docs #988

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

Merged
merged 12 commits into from
Dec 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ req.lib:
req.max-support:
req.namespace:
req.redist:
req.target-min-winverclnt: Windows 10 Build 20348
req.target-min-winversvr: Windows 10 Build 20348
req.target-min-winverclnt: Windows 11
req.target-min-winversvr: Windows Server 2022
req.target-type:
req.type-library:
req.umdf-ver:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ req.lib:
req.max-support:
req.namespace:
req.redist:
req.target-min-winverclnt: Windows 10 Build 20348
req.target-min-winversvr: Windows 10 Build 20348
req.target-min-winverclnt: Windows 11
req.target-min-winversvr: Windows Server 2022
req.target-type:
req.type-library:
req.umdf-ver:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ req.lib:
req.max-support:
req.namespace:
req.redist:
req.target-min-winverclnt: Windows 10 Build 20348
req.target-min-winversvr: Windows 10 Build 20348
req.target-min-winverclnt: Windows 11
req.target-min-winversvr: Windows Server 2022
req.target-type:
req.type-library:
req.umdf-ver:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ You can use the <a href="/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystem
<b>GetProcessAffinityMask</b> returns a bitmask whereas
<b>SetThreadIdealProcessor</b> uses an integer value to represent the processor.

Starting with Windows 11 and Windows Server 2022, on a system with more than 64 processors, process and thread affinities span all processors in the system, across all <a href="/windows/desktop/ProcThread/processor-groups">processor groups</a>, by default.
The <b>SetThreadIdealProcessor</b> function sets the preferred processor to a logical processor in the thread's primary group.

To compile an application that uses this function, define _WIN32_WINNT as 0x0400 or later. For more information, see
<a href="/windows/desktop/WinProg/using-the-windows-headers">Using the Windows Headers</a>.

Expand Down Expand Up @@ -123,4 +126,4 @@ To compile an application that uses this function, define _WIN32_WINNT as 0x0400



<a href="/windows/desktop/ProcThread/multiple-threads">Threads</a>
<a href="/windows/desktop/ProcThread/multiple-threads">Threads</a>
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ If the function fails, it returns zero. To get extended error information, use <

Specifying a thread ideal processor provides a hint to the scheduler about the preferred processor for a thread. The scheduler runs the thread on the thread's ideal processor when possible.

Starting with Windows 11 and Windows Server 2022, on a system with more than 64 processors, process and thread affinities span all processors in the system, across all <a href="/windows/desktop/ProcThread/processor-groups">processor groups</a>, by default.
The <b>SetThreadIdealProcessorEx</b>, in setting the preferred processor, also sets the thread's primary group to the group of the preferred processor.

To compile an application that uses this function, set _WIN32_WINNT &gt;= 0x0601. For more information, see <a href="/windows/desktop/WinProg/using-the-windows-headers">Using the Windows Headers</a>.

<b>Windows Phone 8.1:</b> This function is supported for Windows Phone Store apps on Windows Phone 8.1 and later.
Expand All @@ -94,4 +97,4 @@ To compile an application that uses this function, set _WIN32_WINNT &gt;= 0x0601



<a href="/windows/desktop/api/processthreadsapi/nf-processthreadsapi-setthreadidealprocessor">SetThreadIdealProcessor</a>
<a href="/windows/desktop/api/processthreadsapi/nf-processthreadsapi-setthreadidealprocessor">SetThreadIdealProcessor</a>
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ req.lib:
req.max-support:
req.namespace:
req.redist:
req.target-min-winverclnt: Windows 10 Build 20348
req.target-min-winversvr: Windows 10 Build 20348
req.target-min-winverclnt: Windows 11
req.target-min-winversvr: Windows Server 2022
req.target-type:
req.type-library:
req.umdf-ver:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ If the error value is ERROR_INSUFFICIENT_BUFFER, the <i>GroupCount</i> parameter

## -remarks

Starting with Windows 11 and Windows Server 2022, on a system with more than 64 processors, process and thread affinities span all processors in the system, across all <a href="/windows/desktop/ProcThread/processor-groups">processor groups</a>, by default.

To compile an application that uses this function, set _WIN32_WINNT &gt;= 0x0601. For more information, see <a href="/windows/desktop/WinProg/using-the-windows-headers">Using the Windows Headers</a>.

## -see-also
Expand All @@ -91,4 +93,4 @@ To compile an application that uses this function, set _WIN32_WINNT &gt;= 0x0601



<a href="/windows/desktop/ProcThread/processor-groups">Processor Groups</a>
<a href="/windows/desktop/ProcThread/processor-groups">Processor Groups</a>
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ If the function fails, the return value is zero. To get extended error informati

## -remarks

Starting with Windows 11 and Windows Server 2022, on a system with more than 64 processors, process and thread affinities span all processors in the system, across all <a href="/windows/desktop/ProcThread/processor-groups">processor groups</a>, by default. The <b>GetThreadGroupAffinity</b> function retrieves the group affinity over the thread's primary group.

To compile an application that uses this function, set _WIN32_WINNT &gt;= 0x0601. For more information, see <a href="/windows/desktop/WinProg/using-the-windows-headers">Using the Windows Headers</a>.

## -see-also
Expand All @@ -85,4 +87,4 @@ To compile an application that uses this function, set _WIN32_WINNT &gt;= 0x0601



<a href="/windows/desktop/ProcThread/processor-groups">Processor Groups</a>
<a href="/windows/desktop/ProcThread/processor-groups">Processor Groups</a>
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,11 @@ If the function fails, the return value is zero. To get extended error informati

## -remarks

Starting with Windows 11 and Windows Server 2022, on a system with more than 64 processors, process and thread affinities span all processors in the system, across all <a href="/windows/desktop/ProcThread/processor-groups">processor groups</a>, by default.
The <b>SetThreadGroupAffinity</b> function restricts a thread's affinity to the processors over the single processor group specified by the given <i>GroupAffinity</i>. This group will also become the thread's primary group.

To compile an application that uses this function, set _WIN32_WINNT &gt;= 0x0601. For more information, see <a href="/windows/desktop/WinProg/using-the-windows-headers">Using the Windows Headers</a>.

## -see-also

<a href="/windows/desktop/api/winnt/ns-winnt-group_affinity">GROUP_AFFINITY</a>
<a href="/windows/desktop/api/winnt/ns-winnt-group_affinity">GROUP_AFFINITY</a>
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ A process affinity mask is a bit vector in which each bit represents the process

A process affinity mask is a subset of the system affinity mask. A process is only allowed to run on the processors configured into a system. Therefore, the process affinity mask cannot specify a 1 bit for a processor when the system affinity mask specifies a 0 bit for that processor.

Starting with Windows 11 and Windows Server 2022, on a system with more than 64 processors, process and thread affinities span all processors in the system, across all <a href="/windows/desktop/ProcThread/processor-groups">processor groups</a>, by default. The <b>GetProcessAffinityMask</b> function sets the <i>lpProcessAffinityMask</i> and <i>lpSystemAffinityMask</i> to the process and system processor masks over the process' primary group. If the process had explicitly set the affinity of one or more of its threads outside of the process' primary group, the function returns zero for both affinity masks. If, however, <i>hHandle</i> specifies a handle to the current process, the function always uses the calling thread's primary group (which by default is the same as the process' primary group) in order to set the <i>lpProcessAffinityMask</i> and <i>lpSystemAffinityMask</i>.

## -see-also

<a href="/windows/desktop/ProcThread/multiple-processors">Multiple Processors</a>
Expand All @@ -112,4 +114,4 @@ A process affinity mask is a subset of the system affinity mask. A process is on



<a href="/windows/desktop/api/winbase/nf-winbase-setthreadaffinitymask">SetThreadAffinityMask</a>
<a href="/windows/desktop/api/winbase/nf-winbase-setthreadaffinitymask">SetThreadAffinityMask</a>
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ Do not call <b>SetProcessAffinityMask</b> in a DLL that may be called by process

On a system with more than 64 processors, the <b>SetProcessAffinityMask</b> function can be used to set the process affinity mask only for processes with threads in a single <a href="/windows/desktop/ProcThread/processor-groups">processor group</a>. Use the <a href="/windows/desktop/api/winbase/nf-winbase-setthreadaffinitymask">SetThreadAffinityMask</a> function to set the affinity mask for individual threads in multiple groups. This effectively changes the group assignment of the process.

Starting with Windows 11 and Windows Server 2022, on a system with more than 64 processors, process and thread affinities span all processors in the system, across all processor groups, by default. Instead of always failing in case the calling process contains threads in more than one processor group, the <b>SetProcessAffinityMask</b> function fails (returning zero with <b>ERROR_INVALID_PARAMETER</b> last error code) if the process had explicitly set the affinity of one or more of its threads outside of the process' <a href="/windows/desktop/ProcThread/processor-groups">primary group</a>.

## -see-also

<a href="/windows/desktop/api/processthreadsapi/nf-processthreadsapi-createprocessa">CreateProcess</a>
Expand All @@ -117,4 +119,4 @@ On a system with more than 64 processors, the <b>SetProcessAffinityMask</b> func



<a href="/windows/desktop/api/winbase/nf-winbase-setthreadaffinitymask">SetThreadAffinityMask</a>
<a href="/windows/desktop/api/winbase/nf-winbase-setthreadaffinitymask">SetThreadAffinityMask</a>
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ Setting an affinity mask for a process or thread can result in threads receiving

If the new thread affinity mask does not specify the processor that is currently running the thread, the thread is rescheduled on one of the allowable processors.

Starting with Windows 11 and Windows Server 2022, on a system with more than 64 processors, process and thread affinities span all processors in the system, across all <a href="/windows/desktop/ProcThread/processor-groups">processor groups</a>, by default. The <i>dwThreadAffinityMask</i> must specify processors in the thread's current primary group.

## -see-also

<a href="/windows/desktop/api/winbase/nf-winbase-getprocessaffinitymask">GetProcessAffinityMask</a>
Expand Down Expand Up @@ -120,4 +122,4 @@ If the new thread affinity mask does not specify the processor that is currently



<a href="/windows/desktop/ProcThread/multiple-threads">Threads</a>
<a href="/windows/desktop/ProcThread/multiple-threads">Threads</a>