问题描述
我有一个内存堆管理器,根据系统上的处理器数量将堆分成不同的段。内存只能在当前正在运行的线程的处理器的分区上分配。这将有助于允许不同的处理器继续运行,即使两个不同的人想同时分配内存,至少我相信。
I have a memory heap manager which partitions the heap into different segments based on the number of processors on the system. Memory can only be allocated on the partition that goes with the currently running thread's processor. This will help allow different processors to continue running even if two different ones want to allocate memory at the same time, at least I believe.
我发现函数GetCurrentProcessorNumber )适用于Windows,但这仅适用于Windows Vista及更高版本。
I have found the function GetCurrentProcessorNumber() for Windows, but this only works on Windows Vista and later. Is there a method that works on Windows XP?
此外,可以在POSIX系统上使用pthreads吗?
Also, can this be done with pthreads on a POSIX system?
推荐答案
对于XP,一个快速google显示:这有帮助吗?
For XP, a quick google as revealed this: https://www.cs.tcd.ie/Jeremy.Jones/GetCurrentProcessorNumberXP.htm Does this help?
这篇关于如何找到一个线程正在运行的处理器号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!