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
  • 相关阅读:
    web页面性能优化之接口前置
    python大佬养成计划----flask_bootstrap装饰网页
    撸个查询物流的小程序,欢迎体验
    FullCalendar插件的基本使用
    GeekforGeeks Trie
    使用Django和Python创建Json response
    nginx-gridfs的安装
    Linux kernel config and makefile system
    hadoop日志分析
    安装STS报错(三)
  • 原文地址:https://www.cnblogs.com/dream397/p/13321338.html
Copyright © 2011-2022 走看看