Multithreaded Multicore System

Concepts

Hardware Thread

D-OS-Ch05gca-Hardware_Thread

Memory Stall

當一個 thread 遇到 cache miss 時就需要 access memory,這段 memory access 期間 CPU 是閒置的


Multicore System

過去一個 CPU 上只有一個 core,我們現在將多個 core 放在同一個 CPU 晶片上可以讓其速度快、耗電低(因為共享 L3 Cache)

Multithreaded System

遇到 memory stall 時,立刻切換去執行 。透過 context switch 來隱藏 memory latency,讓 CPU pipeline 保持忙碌

Two Level Scheduling

1. Software Thread Scheduling (OS Layer)

這裡是 OS scheduler 決定要把哪個 software thread (kernel-level thread) 分配到哪個 logical CPU 上面,這是由 OS 的 CPU scheduler 決定的

2. Hardware Thread (Hardware Layer)

每個實體 core 自己決定目前要執行哪個 hardware thread,這是 CPU 本身 microarchitecture 決定

Implementation

D-OS-Ch05gcb-CMT