The cpu information and thread related information of linux are stored in the / proc/cpuinfo file, which can be viewed by name. reference resources: https://www.cnblogs.com/yoyoblogs/p/11289981.html reference resources: https://baijiahao.baidu.com/s?id=1601592414830352193&wfr=spider&for=pc
background knowledge
reference resources: https://zhuanlan.zhihu.com/p/86855590
Number of physical CPUs
It refers to the number of cpu hardware socket s actually inserted on the motherboard. (however, this concept is often referred to as the number of CPUs, which is easily confused with the concepts of core number and processor number, so it is emphasized here that the number of physical CPUs). Since the introduction of multiple cpu slots on the motherboard requires more complex hardware support (connect CPUs in different slots to memory and other resources), usually only on the server. In home computers, there is usually only one cpu slot on the motherboard.
Dominant frequency / Hz
This represents the clock frequency of the core in the CPU, which can be understood as the operation speed.
Compared with human beings, it can be understood that the higher the dominant frequency, the greater the power.

core
in limine, Each physical cpu has only one core (a single core). For the operating system, only one process / thread can run at the same time. In order to improve performance, cpu manufacturers began to add cores on a single physical cpu (real hardware exists), which led to dual core CPUs and multi-core CPUs (multiple cores), such a dual core cpu can run two processes / threads at the same time.
Thread
simultaneous multithreading and hyper – threading/HT
Essentially the same, It is a technology to improve the number of multiple threads that a single core can execute at the same time (make full use of the computing power of a single core and try to make it "not idle for a moment" ). The abbreviation of simultaneous multithreading is the name of SMT, AMD and other cpu manufacturers. Hyper – threading is the name of Intel. It can be considered that hyper – threading is a specific technical implementation of SMT. Under similar technologies, the following equivalent terms are generated:
- Virtual core: virtual core
- Logical processor: logical processor
- Threads: thread
Therefore, it can be said that a 4-core AMD cpu using SMT technology provides the ability of 8 threads to execute at the same time; A 2-core Intel cpu with HT Technology provides the ability of 4 threads executing at the same time.
see information
- Number of CPUs
Record via physical id:
grep 'physical id' /proc/cpuinfo | sort -u # -u is equivalent to uniq processing
Or directly display the count:
grep 'physical id' /proc/cpuinfo | sort -u | wc -l 2
- Number of cores
We can directly view the of each physical cpu:
$ grep 'cpu cores' /proc/cpuinfo | sort -u cpu cores : 24
Take a look at the records in the core:
$ grep 'core id' /proc/cpuinfo core id : 0 core id : 1 core id : 2 core id : 3 core id : 4 core id : 5 core id : 6 core id : 8 core id : 10 core id : 11 core id : 12 core id : 13 core id : 16 core id : 17 core id : 18 core id : 19 core id : 20 core id : 21 core id : 24 core id : 25 core id : 26 core id : 27 core id : 28 core id : 29 core id : 0 core id : 1 core id : 2 core id : 3 core id : 4 core id : 5 core id : 6 core id : 8 core id : 9 core id : 10 core id : 11 core id : 12 core id : 13 core id : 16 core id : 17 core id : 18 core id : 19 core id : 20 core id : 21 core id : 25 core id : 26 core id : 27 core id : 28 core id : 29 core id : 0 core id : 1 core id : 2 core id : 3 core id : 4 core id : 5 core id : 6 core id : 8 core id : 10 core id : 11 core id : 12 core id : 13 core id : 16 core id : 17 core id : 18 core id : 19 core id : 20 core id : 21 core id : 24 core id : 25 core id : 26 core id : 27 core id : 28 core id : 29 core id : 0 core id : 1 core id : 2 core id : 3 core id : 4 core id : 5 core id : 6 core id : 8 core id : 9 core id : 10 core id : 11 core id : 12 core id : 13 core id : 16 core id : 17 core id : 18 core id : 19 core id : 20 core id : 21 core id : 25 core id : 26 core id : 27 core id : 28 core id : 29
It is not difficult to find that the records of the core are duplicated. It is speculated that the physical id is set with the same name, so the records of the core are duplicated. Therefore, it is considered that the 24 cores recorded in the document are more accurate.
- View number of threads
Record through processor:
grep 'processor' /proc/cpuinfo | sort -u | wc -l 96
It can be seen that the server has two CPUs, each cpu has 24 cores, a total of 48 cores and 96 threads, and each core has 2 threads.
- lscpu
You can directly view the cpu information of your computer:
Address sizes: 46 bits physical, 48 bits virtual CPU(s): 96 On-line CPU(s) list: 0-95 Thread(s) per core: 2 Core(s) per socket: 24 Socket(s): 2 NUMA node(s): 2 Vendor ID: GenuineIntel CPU family: 6 Model: 85 Model name: Intel(R) Xeon(R) Platinum 8255C CPU @ 2.50GHz