大网数据广告活动
Windows 系统接口

CPU Sets

· 52CE 我爱测

CPU Sets provide APIs to declare application affinity in a 'soft' manner that is compatible with OS power management.

CPU Sets provide APIs to declare application affinity in a 'soft' manner that is compatible with OS power management. Additionally, the API provides applications with the ability to reaffinitize all background threads in the process to a subset of processors using the Process Default mechanism to avoid interference from OS threads within the process. Some versions of Windows support Core Reservation policies, in which a subset of the system’s CPU Sets can be devoted to the exclusive use of individual applications and workloads.

The CPU Set API works with CPU Set IDs, which are associated with virtual processor affinities. On most systems, and under most conditions, each CPU Set ID will map directly to a single home logical processor. A thread affinitized to a given CPU Set will typically execute on one of the processors in its list of selected CPU Set IDs.

CPU Sets that are reserved can be determined by inspecting the Allocated flag in the SYSTEM_CPU_SET_INFORMATION. The system controls access to reserved CPU Sets and the assignment can be queried using the AllocatedToTargetProcess flag of the SYSTEM_CPU_SET_INFORMATION structure. If a process attempts to use a CPU Set assignment which is allocated exclusively to other processes, its request is ignored and threads assigned to disallowed CPU sets are scheduled elsewhere. CPU Sets can be assigned at two levels. The Process Default CPU sets are assigned to all threads in a process that do not have an assignment at the Thread Selected level. If a thread or process has a restrictive affinity mask set, the affinity mask is respected above any conflicting CPU Set assignment. On multi-group systems, CPU assignments are ignored if they are in groups that do not match the group in the thread’s affinity mask. If a thread is assigned to multiple valid CPU Sets, it will run on one of the corresponding processors according to its priorities and the priorities of competing threads on those processors.

CPU Set Functions/Enumerations/Structures

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 07/14/2025
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。