hi,
i want to code a funtion to determine the number of processors. I know the cpuid function, but i found no documentation about the number of processors.
How can i get the number of processors?
thanks for help!
bye,
matze
number of processors?
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:number of processors?
probably the section about multiprocessors in Intel Manual should provide better information ...
Re:number of processors?
As you should know, cpuid is local. The only way to get to another CPU is to kickstart it and let it tell for itself (at least, it's the way to get all the working ones in your set). You can do that by sending an IPI to the other processors (type ALL_BUT_ME or such) to start working at a certain address where you put some code that takes a mutex, ups the processor count, releases the mutex (could all be done by a LOCK INC [EBX] or so) and then waits for the main processor to tell it what to do. You wait in the main processor for the number to change (5 secs?) and then display that as count of working processors.mk wrote: I know the cpuid function, but i found no documentation about the number of processors.
How can i get the number of processors?
Of course, if you only want to do some statistics stuff, read the APIC settings. They should tell the count.
For info, search on intel for "multiprocessor specification" and/or "APIC" or "IO APIC". The last one I didn't check too far but it should redirect interrupts.