Why is the CPU usage reported by top in Linux over 100%?

60

7

I've seen the CPU usage go over 100%. How is this possible? Is it because I have four CPU cores, so 100% isn't really the max?

Also, when a program does this, what else can I do in top besides using the k command?

tony_sid

Posted 2010-08-11T12:40:28.163

Reputation: 11 651

Answers

67

AFAIK top shows the CPU usage in relation to the power of 1 core, i.e if your task takes up 200% CPU then it's occupying two cores.

lajuette

Posted 2010-08-11T12:40:28.163

Reputation: 4 364

18

From the top man-page

   k: %CPU  --  CPU usage
  The task's share of the elapsed  CPU  time  since  the  last  screen
  update,  expressed as a percentage of total CPU time.  In a true SMP
  environment, if 'Irix mode' is Off, top will operate  in  number  of
  CPUs.  You toggle 'Irix/Solaris' modes with the 'I' interactive com-
  mand.

So, yes, top shows CPU percentage PER core, but you can toggle this behaviour be pressing 'I'.

IanH

Posted 2010-08-11T12:40:28.163

Reputation: 1 144

10

Yes, if a process in top goes over 100% or top shows >1.0 in load, this means that more than one core is occupied, or the system is oversubscribed. Oversubscription means that there is more work to be put onto the core than is phsyically manageble.

In top you can also sort the view by different parameters (like used memory). If you want to look what you can sort by, refer to the help or man page for top.

You can also see all kind of information about the processes themselves, like Virtual or resident memory used by the process and if it's sleeping or currently running, as well as cpu time used.

The load average in the top, if needed, can also be viewed by the uptime command.

private_meta

Posted 2010-08-11T12:40:28.163

Reputation: 2 204

4How can I check whether it is using more than one core or if it's oversubscribed? Thanks! – user1953384 – 2014-09-04T20:01:32.620