Skip to Content

Why CPU utilization is not distributed evenly across all cores in Linux?

A system is having a single core, and if there is a single process consuming all the CPU Time, then CPU utilization will show 100% utilization. But in case of multi core systems it is not necessary that all the CPU’s are been used for running all processes. In such cases uneven CPU utilization across the available CPU’s is a expected behavior.

  • The reason behind uneven CPU utilization is that, it is not always a useful thing to switch CPU’s. There are multiple things need to be performed on top of context switching. Therefore increase in context switching will further increase the latency. It is useful to do context switching only if a single CPU is not able to cope up with the number of processes waiting for CPU in runq.
  • The final intent of above explanation is that if there is 100% CPU utilization on single CPU and 20-30% on remaining CPU’s then it is not a problem always, provided the process is not having CPU affinity set for a particular CPU. In general OS does not imply any CPU affinity on its own. Either a application or user needs to tell kernel to pin a processes to a particular CPU or set of CPU’s.
  • If a process is facing a performance degrade due to high CPU utilization then only it should be addressed.