5

Some system processes like systemsoundservd, logd, diagnosticd, etc. recently use a lots of cpu on my macbook pro. How can I limit them to some degree because most of them are not too relevant to me?

Note: I have already checked out Can I manually limit the %CPU used by a process? but it does not seem to work as expected.

viet@Mozg  ~  pgrep -l systemsoundserv  
506 systemsoundserv  
viet@Mozg  ~  sudo cputhrottle 506 10  
libc++abi.dylib: terminating
with uncaught exception of type Process::ManipulatorException: Error
on task_for_pid of pid 506, res = 5 [1]    7594 abort      sudo
cputhrottle 506 10
4
  • Please clarify what you mean "there are no positive results." What did/didn't happen and what were you expecting?
    – Allan
    Nov 30, 2017 at 20:26
  • Edited. It does not work and throws that exception every time I tried.
    – ntviet18
    Nov 30, 2017 at 20:51
  • Have you tried "nice" and "renice"...
    – Solar Mike
    Nov 30, 2017 at 21:03
  • Thank you. I have tried. But seems like the "fool proof" mechanism of nice prevents me from doing that either.
    – ntviet18
    Nov 30, 2017 at 21:18

5 Answers 5

1

Thos system processes respond to other apps that run, so your first step would be to isolate and identify what programs you have that cause high background system load.

It’s like racing a high performance car and seeing the tires are hot and fuel is being consumed rapidly - those all are the design intent when you press the accelerator to the floor.

It might make more sense to start with your actual workload than try and hobble or disable logging and sound output. Sorry for a side answer, but those processes sit at idle for the vast majority of installations and likely would on your system if you restart and some troubleshooting should show exactly which of your apps trigger this usage pattern.

0

You can try to use nice.

nice is a builtin on macOS and can be used to launch a task with a lower scheduling priority. (Or higher, with superuser).

nice -n 20 yes > /dev/null

Will launch yes with the lowest (and slowest) possible priority. You can also edit the priority of a currently running process by using renice.

home:~ user$ yes > /dev/null &
[1] 2492
home:~ user$ renice -n 20 2492

This will change the priority of the already started process. It is worth pointing out that the yes process still runs at 100%, as this is not really throttling it. Rather, nice makes it so that if multiple programs are competing for resources, the yes program will slowdown and leave your more important tasks alone.

You can see here for more discussion of setting priority on Mac.

2
  • This only changes the priority but does not really limit the cpu usage in itself.
    – tcurdt
    Dec 3, 2019 at 16:01
  • As the user above suggests, this only prevents the process hogging the processor. Because it doesn't limit process, just changes priority. If nothing else is running, a process on nice 20 can still make the machine overheat. Sep 13, 2020 at 19:18
0

An application I have found useful is Turbo Boost Switcher.

It prevents the CPU from going over the base clock. This doesn't target any application specifically, but it does and up throttling down any application that is causing undo strain.

This is useful for conserving battery life or keeping the system cool.

0

You can try cputhrottle: https://download.cnet.com/CPUThrottle/3000-20432_4-75587020.html

I run this via the following script for example :

#!/bin/bash
echo
echo "Process usage limiter: usage \"plimit [process name] [usage limit 0-100%\""

# Process name search and check - exit 1 on error.
echo "Process to limit?" ; read name  
procnum=$( ps xca | grep -i  "$name" | awk '{ print $1 }')  
ps xca | grep -i "$name" 2>/dev/null ; procerror=$? 
[ $procerror -ne "0" ] && echo "Process not found: "$name && echo && exit 1

# Process maxium CPU usage check - exit 2 on error.
echo "Process limit (1-100) ? "  ; read plimit  
[ $plimit -gt 0 ] 2>/dev/null ; limerror=$? 
[ $limerror -ne "0" ] && echo "The process limit must be a number" && echo && exit 2

if [ "$plimit" -le "0" ] || [ "$plimit" -gt "100" ] 
then
echo "That is not a proper limit." ; echo
exit 1
else
echo Command: cputhrottle $procnum $plimit 
sudo cputhrottle $procnum $plimit
-1

I found this alternative: AppPolice

2
  • 1
    What's this an alternative to?
    – JMY1000
    Feb 8, 2018 at 16:26
  • I found the link posted here insightful. The content in this post may actually be helpful, so I don't see the point in people downvoting it. Jul 15, 2019 at 20:59

You must log in to answer this question.

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