CPU instruction on multi-physical-cpu machine
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 CPU开发者_C百科ID instrucion.
Yes and no. There are many systems that multiple processors, and vastly different. The gameboy advance, has both the arm based and z80 based gameboy (cannot use both at the same time). but the nds has an arm9 and arm7 (can/do use both at the same time). The omap you would find in a beagleboard has an arm and a TI dsp (can use both at the same time). I assume you were talking about x86 systems. Most desktops are just an x86. Your mouse and keyboard and things like that probably have 8051s or other various flavors of microcontrollers. But you dont care because these are just USB HID devices or cdrom drives or hard disks. You cant really get at the processor so it doesnt matter that it shows up. Laptops and high end server systems and likely dekstops soon have a second processor or computer in there, for the laptop it is probably an arm, significantly lower power, so the x86 can be turned off in a standby mode, the arm keeps things alive, you wake it up it comes up very fast. On a server the other system is there as a bulletproof watchdog, keeps an eye on the server, provides monitoring and some remote reset and other capabilities. Likewise you cant get at this processor so it does not matter if you cannot find in a CPUID deal. Another one is your video card, hundreds to thousands of gpus. You can get access to those with your programs, as with the omap dsp, but you dont do general purpose processing so again the CPUID wouldnt need to provide that info.
So yes and no. Your computer system as a whole, including peripherals, has many different processors, but the general purpose processing is usually a single or multicore of the same family usually inside the same chip. So CPUID only really needs to give you that core/family.
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.
I assume that the presence of cpuid in your question means an x86/x64 context.
A multi-socket motherboard (bios actually) usually requires all installed processors to report the same cpuid info i e be exactly the same. I guess it could be possible to have processors that are architecturally equal but with differing frequencies but then the mb manufacturer would have to list which combos work and which don't and answer endless emails about why this or that supposedly compatible combo doesn't work.
精彩评论