1

Question:

How can I launch a program such that it only uses X ram and Y CPU cores, etc? I happen to be using Ubuntu in this case, but since I often am on other distros, I need a general GNU/Linux solution.

Example use:

I have a program, openscad, which I want to use to convert an image from 2D to 3D. It runs snappy enough on 50x50, but I would like 500x500, and this effectively takes down an i7 such that I cannot use other programs easily - such as the file manager or firefox. On an older machine, it was basically only responsive to kernel level reboot not even switching to a different virtual terminal with F1 etc.

Search so far:

I think what I am looking for is something called a "quota" manager, but I keep finding stuff for hard disk space, and I just want the computer to remain usable. I'm not sure exactly what I'm looking for but I know its effect. I found : what is the effect of setting cpu.cpu_quota_us in cpu cgroup? but it is unanswered - although it points to my solution maybe?

terdon
  • 234,489
  • 66
  • 447
  • 667
wblan
  • 11
  • 1
  • I've now found: https://linoxide.com/linux-how-to/limit-cpu-usage-processes-linux/ .. but I'm not sure how to automate this. Thanks to @terdon for changing the tags to 'limit' which helped my seaching – wblan Dec 09 '18 at 03:00
  • 1
    Have you tried just launching openscad with nice? That doesn't allow you to set specific limits, but it will run a program with a lower priority: `nice openscad`. That won't help if the problem is RAM, but it should make your system more responsive/ Let me know if that works and I can post an answer. – terdon Dec 09 '18 at 03:05
  • Something like https://askubuntu.com/a/510936/158442 or https://askubuntu.com/a/94743/158442? – muru Dec 09 '18 at 06:34

0 Answers0