CPU 的超线程和 OS 的上下文切换之间的关系?

Relation between CPU's hyperthreading and OS's context switch?

cpu 核心的超线程意味着核心在逻辑上可以被视为两个或更多 logical/virtual cpu 个核心到 运行 多个进程。

操作系统还通过调度和上下文切换提供并发编程。

两者做同样的事情,即支持并发编程吗?

他们是什么关系?例如,OS 的并发性是否需要 cpu 核心提供超线程,反之亦然?

谢谢。

超线程需要额外的硬件支持。

  • 在上下文切换中您必须从硬件中删除所有信息并加载其他进程的信息。

  • 在 HT 的情况下,您有重复的硬件单元,其中预加载了其他进程的信息,因此 开关 非常 swift.

因此对于超线程核心,切换不需要将当前 运行 进程的整个进程控制块取出并加载另一个进程。它只需要切换要从中读取指令的硬件单元。


引用维基百科:

Hyper-threading works by duplicating certain sections of the processor—those that store the architectural state—but not duplicating the main execution resources. This allows a hyper-threading processor to appear as the usual "physical" processor and an extra "logical" processor to the host operating system.