Linux下判断一台机器是多少路,多少核,是否超线程的方法

可以通过查看/proc/cpuinfo来看。

举个例子

[root@robert ~]# cat /proc/cpuinfo
       : 0
vendor_id       : GenuineIntel
family      : 6
model           : 15
model name      : Intel(R) (TM)2           6600  @ 2.40GHz
stepping        : 6
MHz         : 1596.000
cache size      : 4096 KB
     : 0
siblings        : 2
         : 0

       : 2
apicid          : 0
initial apicid  : 0
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 10
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat                                                                              pse36 clflush dts acpi mmx fxsr sse sse2 ss tm pbe nx lm constant_tsc arch_pe                                                                             rfmon pebs bts pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr lahf_lm
bogomips        : 4797.73
clflush size    : 64
power management:

       : 1
vendor_id       : GenuineIntel
family      : 6
model           : 15
model name      : Intel(R) (TM)2           6600  @ 2.40GHz
stepping        : 6
MHz         : 1596.000
cache size      : 4096 KB
     : 0
siblings        : 2
         : 1
       : 2
apicid          : 1
initial apicid  : 1
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 10
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat                                                                              pse36 clflush dts acpi mmx fxsr sse sse2 ss tm pbe nx lm constant_tsc arch_pe                                                                             rfmon pebs bts pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr lahf_lm
bogomips        : 4794.39
clflush size    : 64
power management:

1. 先看一个关键词 ,我们看到两个部分都是0,这说明本机器只有一个物理,所以是单路的。

2. 然后看另外一个关键词,是0和1,说明同时可以运行2个线程,那么是(超线程)呢,还是双核呢?

3. 看第三个关键词 ,结果是2,那么说明是双核机器,不是
如果 是1,那么说明是,而不是双核机器。

相关日志


文章标题:Linux下判断一台机器是多少路,多少核,是否超线程的方法
链接地址:http://mylb.net.cn/2008/11/816.html

想说点什么吗?