How to check the number of CPUs under Linux system

  
                  #Cat /proc /
/proc under cpuinfo
linux /cpuinfo
file displays cpu information

processor will continue to go from 0 to start counting if multiple cpu
flags Threading technology described has ht

physical CPU can determine the number of physical id value of view, compared with the same physical CPU
processor: 4
vendor_id: GenuineIntel
cpu family : 15
model : 4
model name : Intel(R) Xeon(TM) CPU 3.00GHz
stepping : 8
cpu MHz : 3002.700
cache size : 2048 KB
physical Id : 9
siblings : 4
core id : 19
cpu cores : 2
------------------------ ------

processor: 5
vendor_id: GenuineIntel
cpu family: 15
model: 4
model name: Intel (R) Xeon (TM) CPU 3.00 GHz
stepping : 8
cpu MHz : 3002.700
cache size : 2048 KB
physical id : 9
siblings : 4
core id : 19
cpu cores : 2 < Br>-----------------------------------------------
address sizes: 40 bits physical, 48 bits virtual
power management:

Keywords: SMP linux number of multi-CPU Hyper-Threading HT Hyper-Threading

extract knowledge some online:

Hyper-Threading technology is the use of special hardware instructions, the two logical cores simulation Two physical chips allow a single processor to use thread-level parallel computing, which is compatible with multi-threaded operating systems and software, reducing CPU idle time and improving CPU operating efficiency.

with Hyper-Threading timely manner at the same time, the application can use different parts of the chip. Although a single-threaded chip can process thousands of instructions per second, only one instruction can be manipulated at any one time. Hyper-Threading technology enables the chip to perform multi-threading at the same time, which improves the performance of the chip.

Hyper-Threading Technology is executed in a CPU multiple programs simultaneously and share resources within a CPU, in theory, be the same as two CPU to execute two threads at the same time, P4 processors need more Join a Logical CPU Pointer. Therefore, the area of ​​the new generation P4 HT die is 5% larger than the previous P4. The rest, such as ALU (Integer Arithmetic Unit), FPU (Floating Point Unit), and L2 Cache (L2 Cache) remain unchanged, and these parts are shared.

Although the use of Hyper-Threading technology can simultaneously execute two threads, but it does not like two real CPU, each CPU has an independent resource. When both threads need a resource at the same time, one of them will temporarily stop and let the resources go out until they are idle. Therefore, the performance of hyperthreading is not equal to the performance of two CPUs. When

Intel P4 Hyper-Threading has two operating modes, Single Task Mode (single-tasking mode) and Multi Task Mode (multi-tasking mode), when the program does not support Multi-Processing (multiprocessor operation), the system Will stop the operation of one of the logical CPUs, concentrate resources on a single logical CPU, so that the single-threaded program will not reduce performance due to one of the logical CPUs idle, but the logical CPU that is stopped running will still wait for work, occupying a certain amount. Resources, so when the Hyper-Threading CPU runs the Single Task Mode, it may not achieve CPU performance without Hyper-Threading, but the performance gap will not be too large. That is to say, when running single-threaded applications, Hyper-Threading technology can even degrade system performance, especially when multi-threaded operating systems run single-threaded software.

Copyright © Windows knowledge All Rights Reserved