根据 vmstat,我的 Linux 服务器(2xCore2 Duo 2.5 GHz)每秒持续进行大约 20k 次上下文切换。
# vmstat 3
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
2 0 7292 249472 82340 2291972 0 0 0 0 0 0 7 13 79 0
0 0 7292 251808 82344 2291968 0 0 0 184 24 20090 1 1 99 0
0 0 7292 251876 82344 2291968 0 0 0 83 17 20157 1 0 …Run Code Online (Sandbox Code Playgroud) performance-monitoring kernel performance-tuning vmstat context-switch