当我运行时,cat /proc/cpuinfo我得到以下输出(仅包含相关行):
cpu cores: 1
Run Code Online (Sandbox Code Playgroud)
但是,lscpu给了我以下输出:
CPU(s): 2
Run Code Online (Sandbox Code Playgroud)
两者中哪一个是正确的,更重要的是,为什么它们给了我不同的结果?
的完整输出cat /proc/cpuinfo是:
processor : 0
vendor_id : GenuineIntel
cpu family : 15
model : 3
model name : Intel(R) Pentium(R) 4 CPU 2.80GHz
stepping : 4
microcode : 0xe
cpu MHz : 2800.135
cache size : 1024 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fdiv_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 5
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe constant_tsc pebs bts pni dtes64 monitor ds_cpl cid xtpr
bogomips : 5600.27
clflush size : 64
cache_alignment : 128
address sizes : 36 bits physical, 32 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 15
model : 3
model name : Intel(R) Pentium(R) 4 CPU 2.80GHz
stepping : 4
microcode : 0xe
cpu MHz : 2800.135
cache size : 1024 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 1
apicid : 1
initial apicid : 1
fdiv_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 5
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe constant_tsc pebs bts pni dtes64 monitor ds_cpl cid xtpr
bogomips : 5600.27
clflush size : 64
cache_alignment : 128
address sizes : 36 bits physical, 32 bits virtual
power management:
Run Code Online (Sandbox Code Playgroud)
的完整输出lscpu是:
Architecture: i686
CPU op-mode(s): 32-bit
Byte Order: Little Endian
CPU(s): 2
On-line CPU(s) list: 0,1
Thread(s) per core: 2
Core(s) per socket: 1
Socket(s): 1
Vendor ID: GenuineIntel
CPU family: 15
Model: 3
Stepping: 4
CPU MHz: 2800.135
BogoMIPS: 5600.27
L1d cache: 16K
L2 cache: 1024K
Run Code Online (Sandbox Code Playgroud)
(这也可以在https://gist.github.com/IQAndreas/f3f9139b8968987d3716查看。)
Gil*_*il' 14
这与具有包含单个内核的单个处理器一致,该内核通过超线程包含两个执行线程。因此,您有两个逻辑处理器,但它们共享大部分资源(指令解码、算术等)。这允许一些并行性——一个线程可以继续运行,而另一个线程被阻塞(例如等待内存访问),同时降低硬件成本(组件少于两个独立内核)。
查看 的其余输出lscpu和 的内容/proc/cpuinfo。请参阅什么是逻辑 CPU 内核(与物理 CPU 内核相对)?举个例子。
| 归档时间: |
|
| 查看次数: |
12487 次 |
| 最近记录: |