Process and thread CPU usage in Linux top

2.5k Views Asked by At

We just discovered the peculiar feature of the Linux "top" tool.

The feature is that the summary cpu time for all threads is less than the time displayed for entire process. This is observed when our application spawns more than 50 threads and works for several minutes.

So the question is: what is that extra time consumed not by any thread but by the process itself? How is that possible?

As I understand the information about processes and threads CPU usage is taken from /proc/<pid>/stat & /proc/<pid>/task/<tid>/stat files. Who fills these files and why the time in <pid>/stat is not a sum of all <tid>/stat times?

0

There are 0 best solutions below