我有一个带有 I3-3220 的系统,它基于Intel 的信息,有 2 个内核,每个内核(或总共)有 4 个线程。但是,我在观看编码运行时注意到htop
分配avconv
了 16 个逻辑线程。我在这里和 U&L 上搜索并阅读了许多帖子,并根据我阅读的内容我尝试过
sudo dmidecode |egrep "Socket Designation: Proc|((Thread|Core) Count)"
这导致:
Core Count: 2
Thread Count: 2
所以总共有 4 个逻辑 CPU。
但是lscpu
给了我:
Architecture: i686
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 2
Core(s) per socket: 2
Socket(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 58
Stepping: 9
CPU MHz: 3300.000
BogoMIPS: 6606.60
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 3072K
所以总共有 8 个逻辑 CPU。
但sudo lshw -C cpu
返回:
*-cpu:0
description: CPU
product: Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz
vendor: Intel Corp.
physical id: 43
bus info: cpu@0
version: 6.10.9
serial: 0003-06A9-0000-0000-0000-0000
slot: Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz
size: 3300MHz
capacity: 3300MHz
width: 64 bits
clock: 100MHz
capabilities: x86-64 boot fpu fpu_exception wp 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 nx rdtscp constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt tsc_deadline_timer xsave avx f16c lahf_lm arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms cpufreq
configuration: cores=2 enabledcores=1 id=0 threads=2
*-logicalcpu:0
description: Logical CPU
physical id: 0.1
width: 64 bits
capabilities: logical
*-logicalcpu:1
description: Logical CPU
physical id: 0.2
width: 64 bits
capabilities: logical
*-logicalcpu:2
description: Logical CPU
physical id: 0.3
width: 64 bits
capabilities: logical
*-logicalcpu:3
description: Logical CPU
physical id: 0.4
width: 64 bits
capabilities: logical
*-logicalcpu:4
description: Logical CPU
physical id: 0.5
width: 64 bits
capabilities: logical
*-logicalcpu:5
description: Logical CPU
physical id: 0.6
width: 64 bits
capabilities: logical
*-logicalcpu:6
description: Logical CPU
physical id: 0.7
width: 64 bits
capabilities: logical
*-logicalcpu:7
description: Logical CPU
physical id: 0.8
width: 64 bits
capabilities: logical
*-logicalcpu:8
description: Logical CPU
physical id: 0.9
width: 64 bits
capabilities: logical
*-logicalcpu:9
description: Logical CPU
physical id: 0.a
width: 64 bits
capabilities: logical
*-logicalcpu:10
description: Logical CPU
physical id: 0.b
width: 64 bits
capabilities: logical
*-logicalcpu:11
description: Logical CPU
physical id: 0.c
width: 64 bits
capabilities: logical
*-logicalcpu:12
description: Logical CPU
physical id: 0.d
width: 64 bits
capabilities: logical
*-logicalcpu:13
description: Logical CPU
physical id: 0.e
width: 64 bits
capabilities: logical
*-logicalcpu:14
description: Logical CPU
physical id: 0.f
width: 64 bits
capabilities: logical
*-logicalcpu:15
description: Logical CPU
physical id: 0.10
width: 64 bits
capabilities: logical
*-cpu:1
physical id: 1
bus info: cpu@1
version: 6.10.9
serial: 0003-06A9-0000-0000-0000-0000
size: 3GHz
capacity: 3GHz
capabilities: vmx ht cpufreq
configuration: id=0
*-logicalcpu:0
description: Logical CPU
physical id: 0.1
capabilities: logical
*-logicalcpu:1
description: Logical CPU
physical id: 0.2
capabilities: logical
*-logicalcpu:2
description: Logical CPU
physical id: 0.3
capabilities: logical
*-logicalcpu:3
description: Logical CPU
physical id: 0.4
capabilities: logical
*-logicalcpu:4
description: Logical CPU
physical id: 0.5
capabilities: logical
*-logicalcpu:5
description: Logical CPU
physical id: 0.6
capabilities: logical
*-logicalcpu:6
description: Logical CPU
physical id: 0.7
capabilities: logical
*-logicalcpu:7
description: Logical CPU
physical id: 0.8
capabilities: logical
*-logicalcpu:8
description: Logical CPU
physical id: 0.9
capabilities: logical
*-logicalcpu:9
description: Logical CPU
physical id: 0.a
capabilities: logical
*-logicalcpu:10
description: Logical CPU
physical id: 0.b
capabilities: logical
*-logicalcpu:11
description: Logical CPU
physical id: 0.c
capabilities: logical
*-logicalcpu:12
description: Logical CPU
physical id: 0.d
capabilities: logical
*-logicalcpu:13
description: Logical CPU
physical id: 0.e
capabilities: logical
*-logicalcpu:14
description: Logical CPU
physical id: 0.f
capabilities: logical
*-logicalcpu:15
description: Logical CPU
physical id: 0.10
capabilities: logical
这似乎表明总线信息处有 16 个逻辑 CPU:cpu@0 + 总线信息处还有 16 个:cpu@1,并且仅启用了 1 个内核。为了进一步混淆问题cat /proc/cpuinfo
返回:
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 58
model name : Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz
stepping : 9
microcode : 0x10
cpu MHz : 2800.000
cache size : 3072 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fdiv_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 13
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 nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt tsc_deadline_timer xsave avx f16c lahf_lm arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips : 6606.60
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 58
model name : Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz
stepping : 9
microcode : 0x10
cpu MHz : 2400.000
cache size : 3072 KB
physical id : 0
siblings : 4
core id : 1
cpu cores : 2
apicid : 2
initial apicid : 2
fdiv_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 13
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 nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt tsc_deadline_timer xsave avx f16c lahf_lm arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips : 6606.60
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
processor : 2
vendor_id : GenuineIntel
cpu family : 6
model : 58
model name : Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz
stepping : 9
microcode : 0x10
cpu MHz : 2600.000
cache size : 3072 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 2
apicid : 1
initial apicid : 1
fdiv_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 13
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 nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt tsc_deadline_timer xsave avx f16c lahf_lm arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips : 6606.60
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
processor : 3
vendor_id : GenuineIntel
cpu family : 6
model : 58
model name : Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz
stepping : 9
microcode : 0x10
cpu MHz : 3300.000
cache size : 3072 KB
physical id : 0
siblings : 4
core id : 1
cpu cores : 2
apicid : 3
initial apicid : 3
fdiv_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 13
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 nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt tsc_deadline_timer xsave avx f16c lahf_lm arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips : 6606.60
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
在我看来,这表明 CPU 0-3 各有 4 个兄弟姐妹,因此有 16 个逻辑 CPU
为什么这些结果似乎差异如此之大,哪个值得信赖?
额外的问题:如果我确实只启用了 2 个内核中的 1 个,我该如何启用第二个?
不完全是,它说的是 2 个内核和 4 个线程,而不是每个内核 4 个线程,这意味着它有 2 个内核,每个内核有 2 个线程,总共 4 个线程。
我有一个i3-2100双核,和你的差不多,第一个命令
给我同样的结果,2 个 cpu 核心,每个有 2 个线程
lscpu
说我有
我认为您只是误读了,因为它说
4 cpus
的是总线程数,这是一个错误的术语选择,当我第一次看时我也很困惑:)。您有 1 个插槽、2 个内核和每个内核 2 个线程,它报告总共 4 个 CPU,所以这是正确的。
至于
cat /proc/cpuinfo
我的16个逻辑核心是一样的,4个cpu,每个有4个兄弟,但我不知道这是什么意思,所以我查了一下,发现这是服务器故障所以看起来信息是正确的,你总共有 4 个线程,所以每个线程加上它
siblings
的总数是 4,看起来这只是为每个线程单独报告。至于
sudo lshw -C cpu
我的输出非常不同,只是你确定这是你运行的命令吗?
They don't vary, they just have different ways of displaying the information, I would just use
lscpu
as the most "trusted" because it is the easiest to read and should have any information you need but they all are correct.Both your cores are active and hyper threading is enabled, you can turn off hyper threading in your
bios
in the hardware section, this should nicely half the cpu count so you can check the difference easily in a terminal withlscpu
.To disable and enable a single core use these commands
Disable:
Enable:
The part
cpu0
is the first lineprocessor
incat /proc/cpuinfo
, just swap the 0 for the core / thread you wish to disable.