系统中有很多命令可以查看cpu的个数,但是哪个命令输出的是逻辑cpu个数,哪个又是物理cpu个数呢?
从AIX5.3起,系统引入了SMT(Simultaneous multi-threading:同步多线程)的功能,其允许两个处理线程在同一颗处理器上运行,对操作系统而言,一颗物理处理器逻辑上会成为两个处理单元(逻辑处理器)。也就是说,在SMT功能启用的情况下,逻辑cpu个数是物理cpu个数的两倍,而在SMT功能禁用的情况下,逻辑cpu个数与物理cpu个数相等。
下面我们介绍如何通过各种命令检查系统中的物理cpu和逻辑cpu的个数。
1. smtctl
# smtctl
This system is SMT capable. This system supports up to 4 SMT threads per processor. SMT is currently enabled. SMT boot mode is not set. SMT threads are bound to the same physical processor. proc0 has 4 SMT threads. Bind processor 0 is bound with proc0 Bind processor 1 is bound with proc0 Bind processor 2 is bound with proc0 Bind processor 3 is bound with proc0 proc4 has 4 SMT threads. Bind processor 4 is bound with proc4 Bind processor 5 is bound with proc4 Bind processor 6 is bound with proc4 Bind processor 7 is bound with proc4 proc8 has 4 SMT threads. Bind processor 8 is bound with proc8 Bind processor 9 is bound with proc8 Bind processor 10 is bound with proc8 Bind processor 11 is bound with proc8 proc12 has 4 SMT threads. Bind processor 12 is bound with proc12 Bind processor 13 is bound with proc12 Bind processor 14 is bound with proc12 Bind processor 15 is bound with proc12 proc16 has 4 SMT threads. Bind processor 16 is bound with proc16 Bind processor 17 is bound with proc16 Bind processor 18 is bound with proc16 Bind processor 19 is bound with proc16 proc20 has 4 SMT threads. Bind processor 20 is bound with proc20 Bind processor 21 is bound with proc20 Bind processor 22 is bound with proc20 Bind processor 23 is bound with proc20 proc24 has 4 SMT threads. Bind processor 24 is bound with proc24 Bind processor 25 is bound with proc24 Bind processor 26 is bound with proc24 Bind processor 27 is bound with proc24 proc28 has 4 SMT threads. Bind processor 28 is bound with proc28 Bind processor 29 is bound with proc28 Bind processor 30 is bound with proc28 Bind processor 31 is bound with proc28 proc32 has 4 SMT threads. Bind processor 32 is bound with proc32 Bind processor 33 is bound with proc32 Bind processor 34 is bound with proc32 Bind processor 35 is bound with proc32 proc36 has 4 SMT threads. Bind processor 36 is bound with proc36 Bind processor 37 is bound with proc36 Bind processor 38 is bound with proc36 Bind processor 39 is bound with proc36 proc40 has 4 SMT threads. Bind processor 40 is bound with proc40 Bind processor 41 is bound with proc40 Bind processor 42 is bound with proc40 Bind processor 43 is bound with proc40 proc44 has 4 SMT threads. Bind processor 44 is bound with proc44 Bind processor 45 is bound with proc44 Bind processor 46 is bound with proc44 Bind processor 47 is bound with proc44 proc48 has 4 SMT threads. Bind processor 48 is bound with proc48 Bind processor 49 is bound with proc48 Bind processor 50 is bound with proc48 Bind processor 51 is bound with proc48 proc52 has 4 SMT threads. Bind processor 52 is bound with proc52 Bind processor 53 is bound with proc52 Bind processor 54 is bound with proc52 Bind processor 55 is bound with proc52 proc56 has 4 SMT threads. Bind processor 56 is bound with proc56 Bind processor 57 is bound with proc56 Bind processor 58 is bound with proc56 Bind processor 59 is bound with proc56 proc60 has 4 SMT threads. Bind processor 60 is bound with proc60 Bind processor 61 is bound with proc60 Bind processor 62 is bound with proc60 Bind processor 63 is bound with proc60可以看到,该系统具有SMT能力且当前SMT功能已启用。16个物理cpu对应着64个逻辑cpu。
2. bindprocessor
# bindprocessor -q
The available processors are: 0 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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
可以看到可用逻辑cpu个数是64个(0-63)。3. prtconf
# prtconf
System Model: IBM,8205-E6C
Machine Serial Number: ******
Processor Type: PowerPC_POWER7
Processor Implementation Mode: POWER 7
Processor Version: PV_7_Compat
Number Of Processors: 16 ——16个物理cpu
Processor Clock Speed: 3550 MHz
CPU Type: 64-bit
Kernel Type: 64-bit
LPAR Info: 1 02-8EE62
Memory Size: 31488 MB
Good Memory Size: 31488 MB
Platform Firmware level: AL740_126
Firmware Version: IBM,AL740_126
Console Login: enable
Auto Restart: true
Full Core: false
NX Crypto Acceleration: Not Capable
Network Information
Host Name: autochinaebs
IP Address: 192.168.1.123
Sub Netmask: 255.255.255.0
Gateway: 192.168.1.1
Name Server: 192.168.1.221
Domain Name: hand-china.com
Paging Space Information
Total Paging Space: 32768MB
Percent Used: 1%
Volume Groups Information
==============================================================================
Active VGs
==============================================================================
appvg:
PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION
hdisk2 active 1999 38 00..00..00..00..38
==============================================================================
rootvg:
PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION
hdisk0 active 558 412 111..41..37..111..112
hdisk1 active 558 418 111..47..37..111..112
==============================================================================
INSTALLED RESOURCE LIST
The following resources are installed on the machine.
+/- = Added or deleted from Resource List.
* = Diagnostic support not available.
Model Architecture: chrp
Model Implementation: Multiple Processor, PCI bus
+ sys0 System Object
+ sysplanar0 System Planar
* vio0 Virtual I/O Bus
* vsa0 U8205.E6C.028EE62-V1-C0 LPAR Virtual Serial Adapter
* vty0 U8205.E6C.028EE62-V1-C0-L0 Asynchronous Terminal
* pci8 U78AA.001.WZSKF78-P1 PCI Express Bus
+ fcs2 U78AA.001.WZSKF78-P1-C6-T1 8Gb PCI Express Dual Port FC Adapter (df1000f114108a03)
* fcnet2 U78AA.001.WZSKF78-P1-C6-T1 Fibre Channel Network Protocol Device
+ fscsi2 U78AA.001.WZSKF78-P1-C6-T1 FC SCSI I/O Controller Protocol Device
* sfwcomm2 U78AA.001.WZSKF78-P1-C6-T1-W0-L0 Fibre Channel Storage Framework Comm
+ fcs3 U78AA.001.WZSKF78-P1-C6-T2 8Gb PCI Express Dual Port FC Adapter (df1000f114108a03)
* fcnet3 U78AA.001.WZSKF78-P1-C6-T2 Fibre Channel Network Protocol Device
+ fscsi3 U78AA.001.WZSKF78-P1-C6-T2 FC SCSI I/O Controller Protocol Device
* sfwcomm3 U78AA.001.WZSKF78-P1-C6-T2-W0-L0 Fibre Channel Storage Framework Comm
* pci7 U78AA.001.WZSKF78-P1 PCI Express Bus
* pci6 U78AA.001.WZSKF78-P1 PCI Express Bus
+ fcs0 U78AA.001.WZSKF78-P1-C4-T1 8Gb PCI Express Dual Port FC Adapter (df1000f114108a03)
* fcnet0 U78AA.001.WZSKF78-P1-C4-T1 Fibre Channel Network Protocol Device
+ fscsi0 U78AA.001.WZSKF78-P1-C4-T1 FC SCSI I/O Controller Protocol Device
* hdisk2 U78AA.001.WZSKF78-P1-C4-T1-W50050768030474FC-L0 MPIO IBM 2076 FC Disk
* sfwcomm0 U78AA.001.WZSKF78-P1-C4-T1-W0-L0 Fibre Channel Storage Framework Comm
+ fcs1 U78AA.001.WZSKF78-P1-C4-T2 8Gb PCI Express Dual Port FC Adapter (df1000f114108a03)
* fcnet1 U78AA.001.WZSKF78-P1-C4-T2 Fibre Channel Network Protocol Device
+ fscsi1 U78AA.001.WZSKF78-P1-C4-T2 FC SCSI I/O Controller Protocol Device
* sfwcomm1 U78AA.001.WZSKF78-P1-C4-T2-W0-L0 Fibre Channel Storage Framework Comm
* pci5 U78AA.001.WZSKF78-P1 PCI Express Bus
* pci4 U78AA.001.WZSKF78-P1 PCI Express Bus
+ ent0 U78AA.001.WZSKF78-P1-C2-T1 4-Port Gigabit Ethernet PCI-Express Adapter (e414571614102004)
+ ent1 U78AA.001.WZSKF78-P1-C2-T2 4-Port Gigabit Ethernet PCI-Express Adapter (e414571614102004)
+ ent2 U78AA.001.WZSKF78-P1-C2-T3 4-Port Gigabit Ethernet PCI-Express Adapter (e414571614102004)
+ ent3 U78AA.001.WZSKF78-P1-C2-T4 4-Port Gigabit Ethernet PCI-Express Adapter (e414571614102004)
* pci3 U78AA.001.WZSKF78-P1 PCI Express Bus
* pci2 U78AA.001.WZSKF78-P1 PCI Express Bus
* pci1 U78AA.001.WZSKF78-P1 PCI Express Bus
* pci9 U78AA.001.WZSKF78-P1 PCI Bus
+ usbhc0 U78AA.001.WZSKF78-P1 USB Host Controller (33103500)
+ usbhc1 U78AA.001.WZSKF78-P1 USB Host Controller (33103500)
+ usbhc2 U78AA.001.WZSKF78-P1 USB Enhanced Host Controller (3310e000)
* pci0 U78AA.001.WZSKF78-P1 PCI Express Bus
+ sissas0 U78AA.001.WZSKF78-P1-T9 PCIe x4 Planar 3Gb SAS Adapter
* sas0 U78AA.001.WZSKF78-P1-T9 Controller SAS Protocol
* sfwcomm4 SAS Storage Framework Comm
+ hdisk0 U78AA.001.WZSKF78-P2-D1 SAS Disk Drive (300000 MB)
+ hdisk1 U78AA.001.WZSKF78-P2-D2 SAS Disk Drive (300000 MB)
+ ses0 U78AA.001.WZSKF78-P2-Y1 SAS Enclosure Services Device
+ ses1 U78AA.001.WZSKF78-P2-Y1 SAS Enclosure Services Device
* sata0 U78AA.001.WZSKF78-P1-T9 Controller SATA Protocol
* cd0 U78AA.001.WZSKF78-P2-D9 SATA Optical Drive
+ L2cache0 L2 Cache
+ mem0 Memory
+ proc0 Processor
+ proc4 Processor
+ proc8 Processor
+ proc12 Processor
+ proc16 Processor
+ proc20 Processor
+ proc24 Processor
+ proc28 Processor
+ proc32 Processor
+ proc36 Processor
+ proc40 Processor
+ proc44 Processor
+ proc48 Processor
+ proc52 Processor
+ proc56 Processor
+ proc60 Processor
可以看到系统中有8个逻辑cpu。
查看cpu是几个核心的:
A:物理逻辑个数 A=pmcycles -m
B:CPU物理个数
C:核数