zoukankan      html  css  js  c++  java
  • cgroup

    Examples
    Matlab
    Doing large calculations in MATLAB can crash your system, because Matlab does not have any protection against taking all your machine's memory or CPU. The following examples show a cgroup that constrains Matlab to first 6 CPU cores and 5 GB of memory.
    
    With systemd
    ~/.config/systemd/user/matlab.slice
    [Slice]
    AllowedCPUs=0-5
    MemoryHigh=6G
    Launch Matlab like this (be sure to use the right path):
    
    $ systemd-run --user --slice=matlab.slice /opt/MATLAB/2012b/bin/matlab -desktop
    With libcgroup
    /etc/cgconfig.conf
    group matlab {
        perm {
            admin {
                uid = username;
            }
            task {
                uid = username;
            }
        }
    
        cpuset {
            cpuset.mems="0";
            cpuset.cpus="0-5";
        }
        memory {
            memory.limit_in_bytes = 5000000000;
        }
    }
    Change username to the user Matlab is run as.
    
    You can also restrict the CPU share with the cpu constraint.
    
    Launch Matlab like this (be sure to use the right path):
    
    $ cgexec -g memory,cpuset:matlab /opt/MATLAB/2012b/bin/matlab -desktop
    Documentation
    For information on controllers and what certain switches and tunables mean, refer to kernel's documentation v1 or v2 (or install linux-docs and see /usr/src/linux/Documentation/cgroup)
    A detailed and complete Resource Management Guide can be found in the fedora project documentation.
    For commands and configuration files, see relevant man pages, e.g. man cgcreate or man cgrules.conf
  • 相关阅读:
    利用cookie改变背景色
    AsyncResult
    元组Tuple
    子查询和高效分页
    事务
    健康亮黄灯 疾病有信号
    每天学点舒压减压秘诀
    药房里买得到的传世名方:新版
    电子设备热循环和振动故障预防
    LED照明应用基础与实践
  • 原文地址:https://www.cnblogs.com/dream397/p/13321338.html
Copyright © 2011-2022 走看看