Skip to content

Latest commit

 

History

History
35 lines (23 loc) · 1.34 KB

Thread Level Parallelism.md

File metadata and controls

35 lines (23 loc) · 1.34 KB
tags
Arch
Concurrency
OS

Threads

There are two types of threads:

  • Physical threads: Threads that are executing on a hardware core
  • Logical threads: Thread abstractions managed by the OS. Multiple logical threads can map to a single physical thread using time sharing

Hyper-threading

Hyper-threading is a form of SMT that allows one physical core to appear as multiple logical cores

To achieve this, each core has multiple copies of registers, PC, but a single ALU

Context Switch

A context switch involves saving and restoring the process control block (PCB), including:

Imagine a single-threaded program being relocated from one core to another; from a programmer's perspective, the program should behave as if nothing changed (program order). Because registers are saved in RAM, cache coherency ensures that another core will see all changes (even to registers), so the program behaves as expected

References