gpt4 book ai didi

c++ - GetLogicalProcessorInformation 和 SetProcessAffinityMask 中亲和掩码中的位索引是否相同?

转载 作者:可可西里 更新时间:2023-11-01 09:29:48 34 4
gpt4 key购买 nike

SetProcessAffinityMask WinAPI 函数有 dwProcessAffinityMask 参数,其中每一位对应于系统中的单个逻辑处理器。

GetLogicalProcessorInformation WinAPI 函数具有 PSYSTEM_LOGICAL_PROCESSOR_INFORMATION 类型的输出参数 Buffer;此结构的 ProcessorMask 字段是“标识此结构描述的处理器的处理器掩码”。

是否可以保证这两个掩码中的位索引表示相同(对应于相同的逻辑处理器)?

我在 MSDN 上找不到任何明确的信息。

最佳答案

来自 SetProcessAffinityMask :

A process affinity mask is a bit vector in which each bit represents a logical processor on which the threads of the process are allowed to run.

SYSTEM_LOGICAL_PROCESSOR_INFORMATION不是很清楚:

ProcessorMask The processor mask identifying the processors described by this structure. A processor mask is a bit vector in which each set bit represents an active processor in the relationship.

但是GetLogicalProcessorInformation提供更好的信息:

Each of the SYSTEM_LOGICAL_PROCESSOR_INFORMATION structures returned in the buffer contains the following:
•A logical processor affinity mask, which indicates the logical processors that the information in the structure applies to.

所指的逻辑处理器关联掩码是 ProcessorMask 成员。

关于c++ - GetLogicalProcessorInformation 和 SetProcessAffinityMask 中亲和掩码中的位索引是否相同?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16742421/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com