Re: Get current CPU, # of CPUs

From: Jonathan Morrison [MSFT] (jonathanm_at_mindspring.com)
Date: 09/14/04


Date: Tue, 14 Sep 2004 09:00:14 -0700

KeQueryActiveProcessors is the correct API to get the number of processors.
Why are you uneasy about the word active?

-- 
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Micah Brodsky" <eightyfivNOSPAM@PLEASEyahoo.com> wrote in message 
news:OoyXkAhmEHA.3428@TK2MSFTNGP14.phx.gbl...
> Is there a way for a driver to get the maximum number of CPUs so that it 
> can allocate one structure per CPU? I know about KeQueryActiveProcessors, 
> but "active" makes me uneasy. It's not ever possible to hot-plug CPUs, is 
> it?
>
> And, is there a way to get an unambiguous identifier of the current CPU 
> you're running on? Obviously, this would only make sense if it were just a 
> hint or if it could be queried at DISPATCH_LEVEL or above, since otherwise 
> the result could become wrong before you had a chance to see it.
>
> What I'd like to do is allocate some per-cpu junk to be maniuplated at 
> DISPATCH_LEVEL and DIRQL and then be able to grab the appropriate one as 
> necessary in a lock-free manner from ISRs and DPCs and such. I've heard 
> people talking about this sort of thing as though it were a wise design 
> technique, but I can't figure out how to do it!
>
> Thanks a lot.
> --Micah Brodsky
>
>
>