Linux Scheduling

Completely Fair Scheduling (CFS)

Linux 使用 Completely Fair Scheduling (CFS) 來作為 Non-Real-Time Scheduling Algorithm

D-OS-Ch05ia-Completely_Fair_Scheduling

Priority

Nice Value

Linux kernel 會給每個 normal process 一個介於 -19 至 20 之間的值作為 nice value,其表示此 process 的優先級

Weight

CFS 中所使用的權重(weight)是由 nice value 轉換而成

  • nice value = 0,weight = 1024
  • nice value 每差 1,其 weight 大概差 1.25 倍

Scheduling Classes

D-OS-Ch05ib-Scheduling_Classes

NUMA

Linux 實作 NUMA 的方式是將共享 cache 的 core 分到同一個稱為 domain 的地方,當嘗試做 load balancing 時會先嘗試在相同 domain 的 core 做 migration 避免 cold miss