文章目录
请看CPU架构
多个物理CPU,CPU通过总线进行通信,效率比较低,如下:
多核CPU,不同的核通过L2 cache进行通信,存储和外设通过总线与CPU通信,如下:
多核超线程,每个核有两个逻辑的处理单元,两个核共同分享一个核的资源,如下:
物理CPU
实际Server中插槽上的CPU个数
物理cpu数量,可以数不重复的 physical id 有几个
命令:
cat /proc/cpuinfo | grep “physical id
” | sort | uniq | wc -l
CPU核数
一块CPU上面能处理数据的芯片组的数量、比如现在的i5 760,是双核心四线程的CPU、而 i5 2250 是四核心四线程的CPU
一般来说,物理CPU个数×每颗核数就应该等于逻辑CPU的个数,如果不相等的话,则表示服务器的CPU支持超线程技术
命令:
cat /proc/cpuinfo | grep “cores
” | uniq
逻辑CPU
Linux用户对 /proc/cpuinfo 这个文件肯定不陌生. 它是用来存储cpu硬件信息的
信息内容分别列出了processor 0 – n 的规格。这里需要注意,如果你认为n就是真实的cpu数的话, 就大错特错了
一般情况,我们认为一颗cpu可以有多核,加上intel的超线程技术(HT), 可以在逻辑上再分一倍数量的cpu core出来
逻辑CPU数量=物理cpu数量 x cpu cores 这个规格值 x 2(如果支持并开启ht)
备注:Linux下top查看的CPU也是逻辑CPU个数
命令:
cat /proc/cpuinfo | grep “processor
” | wc -l
注:
1 如果逻辑cpu不等于物理cpu乘以cpu核数,可以断定采用了超线程技术
2 当我们 cat /proc/cpuinfo 时,具有相同core id的CPU是同一个core的超线程,具有相同physical id的CPU是同一个CPU封装的线程或核心
/proc/cpuinfo 文件包含系统上每个处理器的数据段落。/proc/cpuinfo 描述中有 6 个条目适用于多内核和超线程(HT)技术检查:processor, vendor id, physical id, siblings, core id 和 cpu cores。
查看cpu运行模式
[root@cos7 ~ ]#lscpu
Architecture: x86_64 #架构
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian #小尾序
CPU(s): 2 #总共2核
On-line CPU(s) list: 0,1
Thread(s) per core: 1 #cpu中每个核core具有的线程,此处支持一个线程,即不支持超线程
Core(s) per socket: 1 #每个插槽上的具有的核数
Socket(s): 2 #总共有2插槽 (一个插槽可以安装一个cpu)
NUMA node(s): 1
Vendor ID: GenuineIntel #cpu产商 intel
CPU family: 6 #cpu系列
Model: 142 #CPU属于其系列中的哪一代的代号
Model name: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
Stepping: 10 #CPU属于制作更新版本
CPU MHz: 2001.000 #CPU的实际使用主频
CPU max MHz: 0.0000 #cpu主频
CPU min MHz: 0.0000
BogoMIPS: 4002.00
Hypervisor vendor: VMware
Virtualization type: full #cpu支持的虚拟化技术
L1d cache: 32K #一级缓存(数据缓存)
L1i cache: 32K #一级缓存(指令缓存)
L2 cache: 256K #二级缓存
L3 cache: 8192K #三级缓存
NUMA node0 CPU(s): 0,1
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch epb fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid rdseed adx smap xsaveopt dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
[ams_zz @HXQ-CMS-APP01 :~]$ cat /proc/cpuinfo
processor : 0 #第几个逻辑cpu
vendor_id : GenuineIntel #CPU制造商
cpu family : 6 #CPU产品系列代号
model : 62 #CPU属于其系列中的哪一代的代号
model name : Intel(R) Xeon(R) CPU E5-4610 v2 @ 2.30GHz #CPU属于的名字及其编号、标称主频
stepping : 4 #CPU属于制作更新版本
cpu MHz : 2300.000 #CPU的实际使用主频
cache size : 16384 KB #CPU二级缓存大小
physical id : 0 #单个CPU的标号
siblings : 8 #单个CPU逻辑物理核数
core id : 0 #当前物理核在其所处CPU中的编号,这个编号不一定连续
cpu cores : 8 #该逻辑核所处CPU的物理核数
apicid : 0 #用来区分不同逻辑核的编号,系统中每个逻辑核的此编号必然不同,此编号不一定连续
fpu : yes #是否具有浮点运算单元(Floating Point Unit)
fpu_exception : yes #是否支持浮点计算异常
cpuid level : 13 #执行cpuid指令前,eax寄存器中的值,根据不同的值cpuid指令会返回不同的内容
wp : yes #表明当前CPU是否在内核态支持对用户空间的写保护(Write Protection)
#当前CPU支持的功能
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc ida nonstop_tsc arat pni ssse3 cx16 sse4_1 sse4_2 popcnt lahf_lm
bogomips : 4600.00 ##在系统内核启动时粗略测算的CPU速度(Million Instructions Per Second)
clflush size : 64 #每次刷新缓存的大小单位
cache_alignment : 64 #缓存地址对齐单位
address sizes : 40 bits physical, 48 bits virtual #可访问地址空间位数
power management: [8] #对能源管理的支持,有以下几个可选支持功能:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 62
model name : Intel(R) Xeon(R) CPU E5-4610 v2 @ 2.30GHz
stepping : 4
cpu MHz : 2300.000
cache size : 16384 KB
physical id : 0
siblings : 8
core id : 1
cpu cores : 8
apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc ida nonstop_tsc arat pni ssse3 cx16 sse4_1 sse4_2 popcnt lahf_lm
bogomips : 4600.00
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management: [8]
processor : 2
vendor_id : GenuineIntel
cpu family : 6
model : 62
model name : Intel(R) Xeon(R) CPU E5-4610 v2 @ 2.30GHz
stepping : 4
cpu MHz : 2300.000
cache size : 16384 KB
physical id : 0
siblings : 8
core id : 2
cpu cores : 8
apicid : 2
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc ida nonstop_tsc arat pni ssse3 cx16 sse4_1 sse4_2 popcnt lahf_lm
bogomips : 4600.00
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management: [8]
processor : 3
vendor_id : GenuineIntel
cpu family : 6
model : 62
model name : Intel(R) Xeon(R) CPU E5-4610 v2 @ 2.30GHz
stepping : 4
cpu MHz : 2300.000
cache size : 16384 KB
physical id : 0
siblings : 8
core id : 3
cpu cores : 8
apicid : 3
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc ida nonstop_tsc arat pni ssse3 cx16 sse4_1 sse4_2 popcnt lahf_lm
bogomips : 4600.00
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management: [8]
processor : 4
vendor_id : GenuineIntel
cpu family : 6
model : 62
model name : Intel(R) Xeon(R) CPU E5-4610 v2 @ 2.30GHz
stepping : 4
cpu MHz : 2300.000
cache size : 16384 KB
physical id : 0
siblings : 8
core id : 4
cpu cores : 8
apicid : 4
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc ida nonstop_tsc arat pni ssse3 cx16 sse4_1 sse4_2 popcnt lahf_lm
bogomips : 4600.00
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management: [8]
processor : 5
vendor_id : GenuineIntel
cpu family : 6
model : 62
model name : Intel(R) Xeon(R) CPU E5-4610 v2 @ 2.30GHz
stepping : 4
cpu MHz : 2300.000
cache size : 16384 KB
physical id : 0
siblings : 8
core id : 5
cpu cores : 8
apicid : 5
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc ida nonstop_tsc arat pni ssse3 cx16 sse4_1 sse4_2 popcnt lahf_lm
bogomips : 4600.00
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management: [8]
processor : 6
vendor_id : GenuineIntel
cpu family : 6
model : 62
model name : Intel(R) Xeon(R) CPU E5-4610 v2 @ 2.30GHz
stepping : 4
cpu MHz : 2300.000
cache size : 16384 KB
physical id : 0
siblings : 8
core id : 6
cpu cores : 8
apicid : 6
fpu :