Linux查看物理CPU个数、核数、逻辑CPU个数

判断依据:

1.具有相同physical id和core id的cpu是同一个core的超线程(processor不同)。
2.具有相同core id的cpu是同一颗cpu封装的超线程。
英文版:
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.

查看当前操作系统内核信息
# uname -a
Linux SV0-15 2.6.18-238.1.1.el5 #1 SMP Tue Jan 25 23:46:15 CST 2011 x86_64 x86_64 x86_64 GNU/Linux

查看当前操作系统发行版信息
#cat /etc/issue
Red Hat Enterprise Linux Server release 5.5 (Tikanga)

查看cpu型号
# cat /proc/cpuinfo | grep 'model name' | cut -f2 -d: | uniq -c
      8  Intel(R) Xeon(R) CPU           E5606  @ 2.13GHz
(看到有8个逻辑CPU, 也知道了CPU型号)

查看物理CPU个数
# cat /proc/cpuinfo| grep "physical id"| sort | uniq | wc -l
2
# cat /proc/cpuinfo| grep "physical id"
physical id     : 1
physical id     : 0
physical id     : 1
physical id     : 0
physical id     : 1
physical id     : 0
physical id     : 1
physical id     : 0
是2个物理cpu,每个都是4核的

查看物理CPU中core的个数(即核数)
# grep 'core id' /proc/cpuinfo | sort -u | wc -l
4
# cat /proc/cpuinfo| grep "cpu cores"| uniq
cpu cores       : 4

查看逻辑CPU的个数(线程数和核数一致,没有开启hyperthreads)
# grep 'processor' /proc/cpuinfo | sort -u | wc -l
8
# grep 'processor' /proc/cpuinfo | sort -u       
processor       : 0
processor       : 1
processor       : 2
processor       : 3
processor       : 4
processor       : 5
processor       : 6
processor       : 7

查看cpu运行模式
# getconf LONG_BIT
64

查看cpu是否支持64bit
# cat /proc/cpuinfo | grep flags | grep ' lm ' | wc -l
8
(结果大于0, 说明支持64bit计算. lm指long mode, 支持lm则是64bit)

cpu详细信息:
# cat /proc/cpuinfo


转载源: http://blog.csdn.net/cbmsft/article/details/7219370

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
查看Linux中的CPU核数,可以使用以下命令: ``` cat /proc/cpuinfo | grep "cpu cores" | uniq ``` 这个命令会显示每个物理CPU中的核数。例如,如果输出是"cpu cores : 8",表示每个物理CPU有8个核。 为了更方便地查看CPU信息,也可以使用top命令,按下键盘上的数字1,就可以查看逻辑CPU个数。 另外,还可以使用以下命令来查看物理CPU个数: ``` cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l ``` 该命令会统计物理CPU个数,并输出结果。 所以,通过这个命令,可以了解到机器上的CPU配置情况。如果结果是1,表示机器只有一个物理CPU。如果结果大于1,则表示机器有多个物理CPU123 #### 引用[.reference_title] - *1* [Linux怎么查看CPU核数](https://blog.csdn.net/fang0604631023/article/details/124588571)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}} ] [.reference_item] - *2* *3* [Linux查看CPU核数](https://blog.csdn.net/weixin_43723877/article/details/124950718)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值