64

I'm playing around with a script and well I got carried away (it's still running right now and yet my computer has not yet died). I'm running 17 iterations of the script (with the intention of crashing my computer).

Looking at the activity monitor I see that each Python process has a unique pid and that they seem to take up about 17-20% of my processing power each... How is that possible? Did my computer magically grow 200% power and break the laws of thermodynamics somewhere?

Enter image description here

  • 28
    300% of a CPU = 3 CPU's. – user253751 Mar 20 '16 at 23:20
  • 7
    "Power levels are 400%" – Nitish Mar 23 '16 at 7:36
  • Reminds me of all those Star Trek episodes where the Warp engines run out of control... – Daniel Mar 23 '16 at 21:05
  • That's some serious overclocking!! – Andrew Grimm Mar 26 '16 at 1:42
101

On OS X, like other *nixes, CPU load is measured per virtual processor core. If you have multiple - you can have 200% and more combined under full load.

This is different from Windows and maybe some other systems, where CPU load is calculated per entire CPU (or CPUs - I do not remember how it behaves when having multiple physical processors).

  • 21
    This answer is only accurate for some platforms! For example, Windows reports total CPU load, rather than as a percentage of a single core. – fabspro Mar 20 '16 at 14:18
  • 2
    Its worth noting that the decimal load representation (ex. 0.5 or 2.4) as reported by for example the uptime command is not the sum of each core usage percentage but rather an estimation of how many cores you'd need to process every request instantly. I'm not sure how much this app normalizes the values. – Sebb Mar 21 '16 at 0:08
  • 3
    @Sebb the load average(LA) is average number of processes waiting for execution, they may be waiting for IO, not necessary cpu – Vasfed Mar 21 '16 at 5:12
  • 3
    @Random832 from linux man - man7.org/linux/man-pages/man1/uptime.1.html : "System load averages is the average number of processes that are either in a runnable or uninterruptable state. A process in a runnable state is either using the CPU or waiting to use the CPU. A process in uninterruptable state is waiting for some I/O access, eg waiting for disk." – Vasfed Mar 21 '16 at 13:34
  • 4
    @slebetman load average is not about cpu time, but the queue length, for example see serverfault.com/a/524818 – Vasfed Mar 22 '16 at 5:23
81

OS X and Linux and possibly other UNIX operating systems (or rather the most common tools on these systems) display CPU usage differently from Windows. On Windows 100% means “all CPU resources used”. On Linux, it means that one “thread” (as in Hyper-threading) is completely busy. As such, it can reach up to (Number of Threads per Core) * (Number of Cores per CPU) * (Number of CPUs) in total.

Although not entirely related, another interesting fact: Windows 10 further normalizes CPU usage using the CPU’s current throttling state. So a 2 GHz CPU running throttled at 1 GHz will only be up to 50% busy.

  • 7
    Interesting fact. :) – Hennes Mar 20 '16 at 15:07
  • 7
    And with Turbo Boost Windows will report the CPU running over 100% – Martheen Cahya Paulo Mar 21 '16 at 8:51
  • I think that's the BSD way, not the *nix way in general. I see the same thing on my Mac and my FreeBSD box. – JDługosz Mar 23 '16 at 3:39
  • 1
    @JDługosz I'm pretty sure it's true of Linux, also, at least for some of its tools. I'm pretty sure top behaves this way, for example. – reirab Mar 25 '16 at 6:45
12

As already pointed out in several answers, Mac shows the CPU percentage of each process as 'percentage of one core' so you should divide that by the number of cores [including HT as 'double']

If you're uncertain as to how many virtual cores you have, Cmd ⌘ 3 will bring up Activity Monitor's CPU History pane, where you can simply count the stripes ;)

enter image description here

Directly below where you chopped off the image is the information you need to quickly determine actual total usage for System:, User: & Idle: Therein lies your simple total to 100%

enter image description here

  • 4
    for real though? 24 cores???? I've barely got 4 :) TIL indeed thanks for sharing this!: puu.sh/nNrHU/f2abb55dc7.png – Frankenmint Mar 20 '16 at 16:23
  • 5
    ahh... yeah - it's a Mac Pro 5,1 - last of the "cheese-graters". Dual 6-core Xeons [+HT] ;) – Tetsujin Mar 20 '16 at 17:03
6

Activity monitor doesn't actually measure the processing power each app/process uses, it just estimates it using an algorithm. So it can be inaccurate...

Also, as @Vasfed points out, CPU consumption is measured per processor core. Multiple cores can mean higher than 100% usage...

A geek occasionally stumbles upon this phenomenon and is flabbergasted until a Superuser comes to his aid... ;D

  • @underscore_d Yeah... but when I answered, there was only one other answer. The other (admittedly better) answers were posted later... – rahuldottech supports Monica Mar 23 '16 at 6:04
  • fair enough, i should've checked the times past the "days" level... it's not that bad :p – underscore_d Mar 23 '16 at 7:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.