Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running a process in a 4 core Ubuntu server. However, 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?

Edit:

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

enter image description here

share|improve this question
1  
Do the 4 cores have 2 threads each (e.g. Intel Core i7)? – Renan Aug 4 '12 at 19:50
    
@Renan, I am running it on single thread. – Arpssss Aug 4 '12 at 19:52
    
OK, then. Because I have seen this happen on some i7 systems. – Renan Aug 4 '12 at 19:53
1  
But is the JVM single-threaded? – Ignacio Vazquez-Abrams Aug 4 '12 at 20:02
4  
This really looks like a fully loaded i7, I usually get this when encoding video – patrix Aug 4 '12 at 20:03
up vote 40 down vote accepted

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 lead to strange results on multicore computers because it easely can exceed 100%.
If you have 8 cores, then top can display from 0% (idle system) to 800% (full power).

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

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.

share|improve this answer
    
Thanks. I used htop and output is given above. – Arpssss Aug 5 '12 at 1:03
5  
+1 for htop. I had no idea it existed. – Brendan Aug 5 '12 at 2:04
    
You can limit any set of processes to a set of cores or limit the % of cpu. However I don't remember the commands. (one is cpulimit) – richard Jul 18 '14 at 8:42
    
+1 for htop, way better than atop, or top – Jason Heine Nov 12 '15 at 15:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .