查看逻辑CPU的方法
smtctl
bindprocessor –q
vmstat
查看物理CPU的方法
prtconf
lsdev -Cc processor
系统中有很多命令可以查看cpu的个数,但是哪个命令输出的是逻辑cpu个数,哪个又是物理cpu个数呢?我们下面做一个简单的介绍。 解答:
从AIX5.3起,对于power5的机器,系统引入了SMT(Simultaneousmulti-threading)的功能,其允许两个处理线程在同一颗处理器上运行,对操作系统而言,一颗物理处理器逻辑上会成为两个处理单元(逻辑处理器)。也就是说,在SMT功能启用的情况下,逻辑cpu个数是物理cpu个数的两倍,而在SMT功能禁用的情况下,逻辑cpu个数与物理cpu个数相等。下面我们介绍如何通过各种命令检查系统中的物理cpu和逻辑cpu的个数。
1. smtctl
# smtctl
This system is SMT capable.
SMT is currently enabled.
SMT boot mode is not set.
SMT threads are bound to the same physical processor.
proc0 has 2 SMT threads.
Bind processor 0 is bound with proc0
Bind processor 1 is bound with proc0
proc2 has 2 SMT threads.
Bind processor 2 is bound with proc2
Bind processor 3 is bound with proc2
proc4 has 2 SMT threads.
Bind processor 4 is bound with proc4
Bind processor 5 is bound with proc4
proc6 has 2 SMT threads.
Bind processor 6 is bound with proc6
Bind processor 7 is bound with proc6
可以看到,该系统具有SMT能力且当前SMT功能已启用。4个物理cpu对应着8个逻辑cpu。
2. bindprocessor
# bindprocessor -q
The available processors are: 0 1 2 3 4 5 6 7
可以看到可用逻辑cpu个数是8个(0-7)。
3. prtconf
# prtconf
System Model: IBM,9131-52A
Machine Serial Number: 0677A5G
Processor Type: PowerPC_POWER5
Number Of Processors: 4 ==》物理cpu有4个
Processor Clock Speed: 1648 MHz
CPU Type: 64-bit
Kernel Type: 64-bit
LPAR Info: 1 06-77A5G
4.lsdev
# lsdev -Cc processor
proc0 Available 00-00 Processor
proc2 Available 00-02 Processor
proc4 Available 00-04 Processor
proc6 Available 00-06 Processor
可以看到系统中有4个物理cpu。
5.vmstat
# vmstat
System configuration: lcpu=8 mem=7936MB
kthr memory page faults cpu
—– ———– ———————— ———— ———–
r b avm fre re pi po fr sr cy in sy cs us sy id wa
1 1 428238 41599 0 0 0 13 25 0 40 1639 182 0 0 99
可以看到系统中有8个逻辑cpu。