I have 2 questions:
1. Can a machine have two or more CPUs which are different in model?
2. If I call CPUID instrucion, will result be any different when different CPUs perform it? (If the answer to quesions1 is right, this is obvious). If so, how can I get all CPUs’ infomation by CPUID instrucion.
I have 2 questions: 1. Can a machine have two or more CPUs which
Share
For this you have to distinguish between “sockets” and “cores” because the term “processor” is ambiguous.
CPUID gives you the information on the current socket, meaning the socket on which the core sits in which the current thread is executing (the thread that contains the CPUID-opcode).
Different sockets can contain slightly different hardware as long as they are compatible, so:
To get the information about a different socket you have to make sure your process gets executed on the socket in question: You can order your operating system to run your thread on a certain socket but that is OS-specific. Search-engine: setting processor affinity for a thread in your OS.
CPUID will tell you everything you need to know about the current socket, including the number of “logical processors”: the logical processor count is equal to the number of cores if your cores are not hyperthreaded, if they are hyperthreading then the logical processor count will be double.