Last Updated: 2023-10-16 13:18:36 Monday
-- TOC --
超线程(HT
,Hyper-Threading)是同时多线程(SMT
,Simultaneous Multi-Theading)技术,它允许一个物理CPU核,同时执行两个控制流。HT技术把一个CPU核当成两颗来用,将一颗具有超线程功能的物理CPU核,变成两颗逻辑CPU,而逻辑CPU对操作系统来说,跟物理CPU并没有太大的区别。因此,操作系统会把工作线程分派给这两颗逻辑CPU上去执行。
注意:两颗逻辑CPU共享单颗物理CPU的所有执行资源,但寄存器是独享的。因此,我们可以认为,超线程技术就是对CPU的虚拟化。现在大家都比较关注自己电脑CPU的核心数,如果支持HT技术,逻辑核心数就是物理核心数的两倍!OS可调度的CPU资源就更多了。
Intel官方对Hyper-Threading Technology介绍:
Hyper-Threading Technology that allows an execution processor IA core to function as two logical processors. While some execution resources such as caches, execution units, and buses are shared, each logical processor has its own architectural state with its own set of general-purpose registers and control registers.
这是我在公司用的台式机:
这是公司借我的笔记本:
$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 36 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 4 ##!!
On-line CPU(s) list: 0-3
Vendor ID: GenuineIntel
Model name: Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
CPU family: 6
Model: 58
Thread(s) per core: 2 ##!!
Core(s) per socket: 2
Socket(s): 1
Stepping: 9
CPU(s) scaling MHz: 52%
CPU max MHz: 3100.0000
CPU min MHz: 1200.0000
BogoMIPS: 4988.93
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat p
se36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdt
scp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology n
onstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx
est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_
deadline_timer aes xsave avx f16c rdrand lahf_lm cpuid_fault epb pt
i ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsba
se smep erms xsaveopt dtherm ida arat pln pts md_clear flush_l1d
Virtualization features:
Virtualization: VT-x
CPU(S)显示为4,这是核心数。Thread(s) per core是2,表示HT开启。
超线程HT技术学习资料:Hyper-Threading.pdf
本文链接:https://cs.pynote.net/hd/202305121/
-- EOF --
-- MORE --