linux+多核+超线程,LINUX系统 多核CPU小记

物理CPU,多核,超线程

判断依据:

1.具有相同core id的cpu是同一个core的超线程。

2.具有相同physical id的cpu是同一颗cpu封装的线程或者cores。

英文版:

1.Physical id and core id are not necessarily consecutive but they are unique. Any cpu with the same core id are hyperthreads in the same core.

2.Any cpu with the same physical id are threads or cores in the same physical socket. 1.

物理CPU,多核,超线程

1)物理CPU个数

$ cat /proc/cpuinfo | grep "physical id" | uniq

physical id     : 0

=>CPU个数:1个

2)CPU核数

$ cat /proc/cpuinfo | grep "cpu cores" | uniq

cpu cores       : 8

=》CPU核数:8个核

3)是否是超线程

$ cat /proc/cpuinfo | grep "core id"

core id         : 0

core id         : 1

core id         : 2

core id         : 3

core id         : 4

core id         : 5

core id         : 6

core id         : 7

=》core id都不一样,所以没有超线程

2。查看每个CPU的使用率

$top -d 1(数字1)

再按数字1,显示如下

Tasks: 194 total,   1 running, 193 sleeping,   0 stopped,   0 zombie

Cpu0  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st

Cpu1  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st

Cpu2  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st

Cpu3  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st

Cpu4  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st

Cpu5  :  0.0%us,  1.0%sy,  0.0%ni, 99.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st

Cpu6  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st

Cpu7  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st

Mem:   3095260k total,  1871716k used,  1223544k free,   622332k buffers

Swap:  4191228k total,        0k used,  4191228k free,   904036k cached

3。查看进程是哪个CPU上运行

$top -d 1(数字1)f,进入"top Current Fields" j,选中  j: P          = Last used cpu (SMP) 回车 多了一列P,COMMAND前面   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  P COMMAND                                        9978 public    20   0  2632 1196  876 R    1  0.0   0:02.64 5   top                                           4。查看当前内核是否支持SMP $uname -a Linux  2.6.31-14-generic #48-Ubuntu SMP Fri Oct 16 14:04:26 UTC 2009 i686 GNU/Linux 有SMP

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值