当前位置: 技术问答>linux和unix
关于CPU的个数问题
来源: 互联网 发布时间:2016-09-24
本文导语: 我在网上看了超线程的文章,然后在机了验证了: #cat /proc/cpuinfo | grep Physical Physical processor ID : 0 Physical processor ID : 0 Physical processor ID : 3 Physical processor ID : 3 这里说我的CPU只有两个(0,3) #top C...
我在网上看了超线程的文章,然后在机了验证了:
#cat /proc/cpuinfo | grep Physical
Physical processor ID : 0
Physical processor ID : 0
Physical processor ID : 3
Physical processor ID : 3
这里说我的CPU只有两个(0,3)
#top
CPU0 states: 0.0% user, 0.1% system, 0.0% nice, 99.0% idle
CPU1 states: 0.0% user, 0.0% system, 0.0% nice, 100.0% idle
CPU2 states: 5.0% user, 20.1% system, 0.0% nice, 74.0% idle
CPU3 states: 0.0% user, 12.0% system, 0.0% nice, 87.0% idle
这里说我的CPU只有四个(0,1,2,3)
是哪理解错了?
#cat /proc/cpuinfo | grep Physical
Physical processor ID : 0
Physical processor ID : 0
Physical processor ID : 3
Physical processor ID : 3
这里说我的CPU只有两个(0,3)
#top
CPU0 states: 0.0% user, 0.1% system, 0.0% nice, 99.0% idle
CPU1 states: 0.0% user, 0.0% system, 0.0% nice, 100.0% idle
CPU2 states: 5.0% user, 20.1% system, 0.0% nice, 74.0% idle
CPU3 states: 0.0% user, 12.0% system, 0.0% nice, 87.0% idle
这里说我的CPU只有四个(0,1,2,3)
是哪理解错了?
|
1.物理cpu个数:
[root@localhost ~]# cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l
2.每个物理cpu中逻辑cpu(可能是core、threads或both)的个数
[root@localhost ~]# cat /proc/cpuinfo | grep "siblings" | uniq
siblings : 8
所以你虽然有2个物理cpu 但是每个cpu应该是2核的等等
你top里显示的应该是逻辑cpu
[root@localhost ~]# cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l
2.每个物理cpu中逻辑cpu(可能是core、threads或both)的个数
[root@localhost ~]# cat /proc/cpuinfo | grep "siblings" | uniq
siblings : 8
所以你虽然有2个物理cpu 但是每个cpu应该是2核的等等
你top里显示的应该是逻辑cpu