c++ - Cgroup usage to limit resources -
my goal: provide user way limit resources cpu, memory given process (c++).
so suggested me utilize cgroups looks ideal utility.
after doing research have concern:
when utilize memory.limit_in_bytes limit memory usage given process, there way handle out of memory exception in process? see control groups provide parameter called "memory.oom_control" when enabled, kills process requesting more memory allowed. when disabled pauses process.
i want way let process know requesting more memory expected , should throw out of memory exception. process gracefully exits.
does cgroups provide such kind of behaviour?
also cgroup available in flavour of linux? interested in rhel 5+, centos 6+ , ubuntu 12+ machines.
any appreciated.
thanks
i want way let process know requesting more memory expected , should throw out of memory exception. process gracefully exits.
does cgroups provide such kind of behaviour?
all processes in recent releases run inside cgroup, default one. if create new cgroup , migrate process new cgroup, works before using constraints new cgroup. if process allocates more memory permitted, gets enospc or malloc failure presently does.
Comments
Post a Comment