Linux上如何查看物理CPU个数,核数,线程数
首先,看看什么是超线程概念
超线程技术就是利用特殊的硬件指令,把两个逻辑内核模拟成两个物理芯片,让单个处理器都能使用线程级并行计算,进而兼容多线程操作系统和软件,减少了CPU的闲置时间,提高的CPU的运行效率。
超线程技术是在一颗CPU同时执行多个程序而共同分享一颗CPU内的资源,理论上要像两颗CPU一样在同一时间执行两个线程,虽然采用超线程技术能同时执行两个线程,但它并不象两个真正的CPU那样,每个CPU都具有独立的资源。当两个线程都同时需要某一个资源时,其中一个要暂时停止,并让出资源,直到这些资源闲置后才能继续。因此超线程的性能并不等于两颗CPU的性能。
其次,看看物理CPU个数,核数以及线程数的关系
总核数 = 物理CPU个数 * 每颗物理CPU的核数
总逻辑CPU数 = 物理CPU个数 * 每颗物理CPU的核数 * 超线程数
上述公式中,逻辑CPU数即线程数
如何查看CPU物理个数
# grep 'physical id' /proc/cpuinfo | sort -u
physical id :
physical id :
如何查看每个物理CPU的核数
# grep 'core id' /proc/cpuinfo | sort -u | wc -l
8
如何查看总的逻辑CPU个数
# grep 'processor' /proc/cpuinfo | sort -u | wc -l
32/8/2=2,可见该CPU支持并已打开超线程。
如何查看CPU的型号
# dmidecode -s processor-version
Intel(R) Xeon(R) CPU E5- @ .10GHz
Intel(R) Xeon(R) CPU E5- @ .10GHz
关于物理CPU,核数以及超线程的区别
A core is the most basic computational unit of a processor. A processor is made up of one or more cores. Tradition processors had only one core while modern processors have multiple cores.
A core consists of an ALU, CU, and a set of registers.
A core consists of two levels of caches called L1 and L2 which is there in each core.
A processor consists of a cache that is shared by call cores called L3 cache. It is common to all cores.
A processor depending on the architecture can consist of a memory controller and an input/output controller.
Certain processor packages consist of Graphics Processing Units (GPU) as well.
A core that does not have hyper-threading can execute only one instruction at a time while a multicore processor made up of several cores can execute several instructions parallel. If a processor is made up of 4 cores that do not support hyper threading then that processor can execute 4 instructions at the same time.
A core having hyper-threading technology has redundant functional units so that they can execute multiple instructions at a time. For example, a core with 2 threads can execute 2 instructions at the same time hence a processor with 4 such cores can execute 2×4 instructions parallel. These threads are usually called logical cores and the task manager of Windows generally show the number of logical cores but not the physical cores.
参考:
1. http://www.differencebetween.com/difference-between-core-and-vs-processor/
2. http://jingyan.baidu.com/article/63acb44a81001361fcc17e21.html
Linux上如何查看物理CPU个数,核数,线程数的更多相关文章
- 【linux】之查看物理CPU个数、核数、逻辑CPU个数
# 总核数 = 物理CPU个数 X 每颗物理CPU的核数 # 总逻辑CPU数 = 物理CPU个数 X 每颗物理CPU的核数 X 超线程数 # 查看物理CPU个数 cat /proc/cpuinfo| ...
- Linux查看物理CPU个数,核数,逻辑CPU个数;内存信息
# 总核数 = 物理CPU个数 X 每颗物理CPU的核数 # 总逻辑CPU数 = 物理CPU个数 X 每颗物理CPU的核数 X 超线程数 # 查看物理CPU个数 cat /proc/cpuinfo| ...
- Linux Shell查看物理CPU个数、核数、逻辑CPU个数
Linux Shell常用命令: ====================================== # 总核数 = 物理CPU个数 X 每颗物理CPU的核数 # 总逻辑CPU数 = 物理C ...
- 【Linux】查看物理CPU个数、核数、逻辑CPU个数
①物理cpu数:主板上实际插入的cpu数量,可以数不重复的 physical id 有几个(physical id) cat /proc/cpuinfo| grep "physical id ...
- Linux查看物理CPU个数、核数、逻辑CPU个数
# 总核数 = 物理CPU个数 X 每颗物理CPU的核数 # 总逻辑CPU数 = 物理CPU个数 X 每颗物理CPU的核数 X 超线程数 # 查看物理CPU个数 cat /proc/cpuinfo| ...
- [转]Linux查看物理CPU个数、核数、逻辑CPU个数
From : http://www.cnblogs.com/emanlee/p/3587571.html # 总核数 = 物理CPU个数 X 每颗物理CPU的核数 # 总逻辑CPU数 = 物理CPU个 ...
- Linux查看物理CPU个数、核数、逻辑CPU个数(转载)
# 总核数 = 物理CPU个数 X 每颗物理CPU的核数 # 总逻辑CPU数 = 物理CPU个数 X 每颗物理CPU的核数 X 超线程数 # 查看物理CPU个数cat /proc/cpuinfo| g ...
- Linux查看物理CPU个数、核数、逻辑CPU个数 (转)
# 总核数 = 物理CPU个数 X 每颗物理CPU的核数 # 总逻辑CPU数 = 物理CPU个数 X 每颗物理CPU的核数 X 超线程数 # 查看物理CPU个数 cat /proc/cpuinfo| ...
- Linux 命令--查看物理CPU个数、核数、逻辑CPU个数
# 总核数 = 物理CPU个数 X 每颗物理CPU的核数 # 总逻辑CPU数 = 物理CPU个数 X 每颗物理CPU的核数 X 超线程数 # 查看物理CPU个数 cat /proc/cpuinfo| ...
随机推荐
- 【.net 深呼吸】细说CodeDom(4):类型定义
上一篇文章中说了命名空间,你猜猜接下来该说啥.是了,命名空间下面就是类型,知道了如何生成命名空间的定义代码,之后就该学会如何声明类型了. CLR的类型通常有这么几种:类.接口.结构.枚举.委托.是这么 ...
- logstash file输入,无输出原因与解决办法
1.现象 很多同学在用logstash input 为file的时候,经常会出现如下问题:配置文件无误,logstash有时一直停留在等待输入的界面 2.解释 logstash作为日志分析的管道,在实 ...
- inline-block元素间距问题的几种解决方案
不知道大家有没有碰到过设置了display:inline-block;的几个相邻元素之间有几px间距的问题,这里提供几种简单实用的解决方法,希望能够帮到大家! 方法1. 将<li>标签 ...
- zookeeper源码分析之一服务端启动过程
zookeeper简介 zookeeper是为分布式应用提供分布式协作服务的开源软件.它提供了一组简单的原子操作,分布式应用可以基于这些原子操作来实现更高层次的同步服务,配置维护,组管理和命名.zoo ...
- StrategyPattern (策略模式)
/** * 策略模式 * @author TMAC-J * 根据环境的不同选择不同的策略,把策略用接口抽象出来 */ public class StrategyPattern { interface ...
- H3 BPM引擎API接口
引擎API接口通过 Engine 对象进行访问,这个是唯一入口. 示例1:获取组织机构对象 this.Engine.Organization.GetUnit("组织ID"); 示例 ...
- android绘制圆形图片的两种方式
看下效果先 下面有完整的示例代码 使用BitmapShader(着色器) 我们在绘制view 的时候 就是小学上美术课 用水彩笔在本子上画画 使用着色器绘制圆形图片最简单的理解方式 就是把bitmap ...
- sqlserver批量修改首字母为大写
'hello world' ----> 'Hello world' update tableName set columnName=CHAR(ASCII(SUBSTRING(columnN ...
- centos 6.5 升级php
1>追加CentOS 6.5的epel及remi源. # rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-re ...
- Java集合---ConcurrentHashMap原理分析
集合是编程中最常用的数据结构.而谈到并发,几乎总是离不开集合这类高级数据结构的支持.比如两个线程需要同时访问一个中间临界区(Queue),比如常会用缓存作为外部文件的副本(HashMap).这篇文章主 ...