Although cgroups seemingly allow to control the CFS bandwidth of a cgroup, I don't see a way of enforcing a cpu time limit on a cgroup. The use case is that I would like to catch student programs that e.g. go into an infinite loop.

  • 1
    I solved this with getrlimit(2) (to limit CPU time per process, which are inherited by its children) and limits.conf(5) (to limit forking, which is a good idea anyhow). But this is not very fine grained. – oleks Apr 12 '14 at 11:50
  • 1
    Please, take a time and post your comment as an answer and accept it :) – user34720 Mar 5 '15 at 18:21

You can use the information from this Red Hat page if you want to stick to Control Groups, but I think your ulimit solution is a reasonable approach and doesn't require the configuration that cgroups would require (just add one command to /etc/profile and you're good).

| improve this answer | |

Your Answer

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

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