如何找到一个线程正在运行的处理器号? [英] How can you find the processor number a thread is running on?

查看:103
本文介绍了如何找到一个线程正在运行的处理器号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个内存堆管理器,根据系统上的处理器数量将堆分成不同的段。内存只能在当前正在运行的线程的处理器的分区上分配。这将有助于允许不同的处理器继续运行,即使两个不同的人想同时分配内存,至少我相信。

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显示: https ://www.cs.tcd.ie/Jeremy.Jones/GetCurrentProcessorNumberXP.htm 这有帮助吗?

For XP, a quick google as revealed this: https://www.cs.tcd.ie/Jeremy.Jones/GetCurrentProcessorNumberXP.htm Does this help?

这篇关于如何找到一个线程正在运行的处理器号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆