55

I am running a process in a 4 core Ubuntu server. However, the top command shows that the CPU usage is 799% all the time.

How can this be possible? I know for multi-core CPUs, more than 100% CPU usage is expected, but 799% is a really high value.

Can anybody explain to me why and when this could happen?

As per suggestion of Gregory MOUSSAT, using htop, I got the following output:

htop screenshot

Arpssss
  • 901

1 Answers1

74

The scale used by top is 100% when a core is fully used. Or when one core is 20% and a second one is 80%. This leads to strange results on multicore computers because it easily can exceed 100%.

If you have 8 cores, then top can display CPU usage from 0% (idle system) to 800% (full power).

Your program is just using your 4 cores with hyper-threading (so 8 virtual cores) at maximum capacity. So top gives you nearly 8 x 100% = 800%.

To change this way of calculating CPU usage (it's called Irix mode), press uppercase 'i': Shift+i

You can't explicitly tell the JVM to use a single thread, it will use multiple threads to do its work, even if you only use a single thread in your application.

You can use the htop utility as a better top alternative. You'll see your program using all of the 8 cores.