A bit different from what you're asking but for this kind of use, I generally use cpulimit (link). It allows you to artificially limit the amount of CPU consumed by a process.
To limit PID 123456 to 20% CPU for instance, you do:
sudo cpulimit -l 20 123456
Yes, as I mentioned, bash calls are asynchronous (at least to the process.) I wrote this at night with no thought or consideration what so ever for efficiency.
I could have wrote it in C, but I felt like I would be putting too much effort in that.
And to be honest, I should have done my fucking research because an application called cpulimit (sudo apt-get install cpulimit) already exists and does the job much more elegantly, but doesn't work on individual threads. It still creates lag and skipping problems like my "solution" does though.
Thus, I am downvoting my own submission.
This is a legitimate question. Good to tame tasks like video encoding or compiling in the background if they're not time critical, so they won't bog down your machine.
You can use nice to set the scheduling priority of a process by the Mach kernel. Usually all processes start at 0, but using this you can set the priority from -20 to +20.
nice -n -20 PID would set lowest priority. PID is the process ID, see Activity Monitor.
There are also tools like this one: https://github.com/opsengine/cpulimit
> The control of the used CPU amount is done sending SIGSTOP and SIGCONT POSIX signals to processes.
It's pausing and resuming a process at certain intervals. This can result in crashy behaviour though. I wouldn't use it.
I tried strangle but this sadly had no effect on the performance.
Then i tried cpulimit which reduced the usage to eg. 50% but then the UI stuttered ingame.
Then i tried cpufrequtils like this and reduced the cpu frequency. Now the game runs smoothly with 1.2 instead of 1.8 Ghz and the temperature is at a constant 57°C instead of 71°C.
So this is kind of a workaround. CPU usage is still at 100% but the temperature is lower.
Thanks for your help anyway!
I've been keeping an eye out for similar things.
Closest that seems to exist (that I've tried to use for some games on my low-resources machine) is https://github.com/opsengine/cpulimit. It takes some experimenting to try to find a balance between intolerable-fps-stuttering and crazy-fan-speed.
Haven't tested it specifically with Farming Simulator, but I imagine it would work the same. YMMV.
If you limit the cpu usage of your web-server it will also limit the speed and solve the problem.
I am using cpulimit to limit the cpu usage during video compilation with avconv so I don't get my cpu too hot - it works really well.
CPUlimit - it's a pretty nifty program that forces misbehaving processes to sleep so I'm not waiting ten minutes for a terminal to execute killall -9 chromium. Thanks to the fact that chrome is multi-process, the damage is contained to just one tab.
I tested it with a inline gzip DoS attack and eveything ran fine!
here's the link I used to test it THIS LINK CRASHES BROWSERS
I to have been experiencing this... it also annoying eats away at my battery life if I forget to quit it when on battery.
I'm trying out using cpulimit to limit GDFS cpu limit on my 13" 2015 MBP [on High Sierra]: https://github.com/opsengine/cpulimit (I installed via homebrew)
But of course, it seems to slow down the application a bit but not sure if that affects functionality right now (I limited it to 20% to start with).
I might give some updates later if this helps/causes any problems.
If you are on linux, you can use cpulimit and specify the max processor usage for quarkcoin to 100% (all four cores would be 400%). I'm not positive this will work, but its something to try. If you are on windows you could decrease the priority of the process in the task manager.