I noticed that both the Mathematica front end and kernel are using the CPU constantly. In the end this hurts battery life and is particularly inconvenient when I forget to bring the charger to work ...

The kernel CPU usage hovers around 0.6% for both the main kernel and service kernel:

enter image description here

(A standalone kernel, i.e. one not connected to a front end, is using only 0.1%.)

The front end CPU usage hovers around 1.3%:

enter image description here

OS X always blames Mathematica for using a lot of power:

enter image description here

All this is with a freshly started Mathematica with a single empty notebook.

Most importantly, having Mathematica running in the background does have a noticeable effect on battery life, even after forcing the OS to use only integrated graphics. That's actually surprising because the CPU usage is really low. But why is it there at all? Other programs typically have 0% CPU usage when idle.

Is this normal or is there something broken on my system? Is it specific to OS X?

This is on OS X 10.11.6 with Mathematica 11.0.0, but it's been the same with earlier versions too as far as I remember.

  • $\begingroup$ Yes, I noticed it some unremembered number of versions ago, and without any real evidence other than timing, I associate with the rise of multicore machines. I also noticed it in other applications, but M tends to be the worst. My imagination suggests that developers don't worry about running a little helper function now and then, because modern CPUs always have another core available. But it's probably something I don't even know about. $\endgroup$ – Michael E2 Sep 12 '16 at 10:52
  • $\begingroup$ My front end CPU goes to 0.% after less than a minute if switch to another app AND don't nothing at all. But If i just scroll a window (in another app), mma front end CPU takes about 1% (OS X 10.9.5, mma 11.0.0) $\endgroup$ – SquareOne Sep 12 '16 at 18:41
  • $\begingroup$ @SquareOne Hm, you are correct. I wonder if that is the OS's doing or Mathematica itself. I suspect the "app nap" feature at work. Notice that the kernel process still keeps going with 0.6% and that the front end only ceases using resources if it is not the foreground application. $\endgroup$ – Szabolcs Sep 12 '16 at 18:44
  • $\begingroup$ I've noticed this too. The best solution I've come with involves creating two scripts "stopmma" and "startmma" that send SIGSTOP/SIGCONT to WolframKernel and JLink. ``` killall -SIGSTOP "WolframKernel" pgrep -f "JLink" | xargs kill -SIGSTOP ``` You then use these two in an application that uses accessibility API to watch for when Mathematica is hidden, and if so pauses it (and vice-versa for resumption). Since this only takes effect when MMA is hidden (not just in background) this shouldn't interfere with usual computation. Finally hook this up via launchd to run automatically. $\endgroup$ – 1110101001 Dec 18 '19 at 3:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.