Linux - Cgroups (Control Groups)

1 - About

With cgroups, it's possible to allocate resources dynamically to process

3 - Example

  • Installation (On CentOS)

sudo yum install -y \
   libcgroup \
   libcgroup-tools # the service

4 - Management

4.1 - List

lscgroup list all cgroups

Example:

  • list all cgroups which are in hierarchy containing cpu controller

lscgroup -g cpu:/

  • list all cgroups which are in hierarchy containing cpu controller in subgroup student

lscgroup -g cpu:/student

  • list all cgroups which in all hierarchies

lscgroup

4.2 - Create

See cgcreate

4.3 - Set

See cgset

5 - Example

5.1 - 50% CPU

  • Create a group with the cpu scheme

sudo cgcreate -g cpu:/cpu_50

  • Set the shares of the CPU where the shares are a portion of the CPU utilization. Every process get by defaults 1024 shares

sudo cgset -r cpu.shares=512 cpu_50

  • Usage

sudo cgexec -g cpu:cpu_50 mybigcommand

6 - Documentation / Reference


Data Science
Data Analysis
Statistics
Data Science
Linear Algebra Mathematics
Trigonometry

Powered by ComboStrap