nereuschen / blog

blog
44 stars 11 forks source link

正确认识CPU和load average #32

Open nereuschen opened 9 years ago

nereuschen commented 9 years ago

亲,load怎么了?已经飙到了20+

load是如何计算的

load = run queue length (运行队列中的等待进程和正在执行的进程数)

参考资料: Understanding Linux CPU Load - when should you be worried? 中文版

正确认识物理CPU、多核和逻辑CPU

查看逻辑CPU

逻辑CPU个数=物理CPU个数_cores个数_2(开启超程)

查看物理CPU、多核和逻辑CPU

cat /proc/cpuinfo

load到底多大比较合适?

逻辑CPU个数*0.7

Linux Scheduler

参考资料 Scheduling in Linux Inside the Linux scheduler

Linux Scheduler算法演示 相关算法在线演示

进程状态

R running or runnable (on run queue) D uninterruptible sleep (usually IO) S interruptible sleep (waiting for an event to complete) Z defunct/zombie, terminated but not reaped by its parent T stopped, either by a job control signal or because it is being traced

参考资料: Linux进程状态 Linux进程的三种状态

OS中定义的进程状态

参考资料 Operating system concepts

load实例

high load & cpu

high load low cpu (todo)

上下文切换频繁

常用命令