title: How can you find the processor number a thread is running on?
body: <p>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.</p>
  
  <p>I have found the function <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms683181(v=vs.85).aspx" rel="nofollow noreferrer"><code>GetCurrentProcessorNumber()</code></a> for Windows, but this only works on Windows Vista and later.  Is there a method that works on Windows XP?</p>
  
  <p>Also, can this be done with pthreads on a POSIX system?</p>