"The control groups, abbreviated as cgroups in this guide, are a Linux kernel feature that allows you to allocate resources — such as CPU time, system memory, network bandwidth, or combinations of these resources — among hierarchically ordered groups of processes running on a system."
Check the cgroups by systemd-cgls
.
"A resource controller, also called a cgroup subsystem, represents a single resource, such as CPU time or memory."
Check the controllers under /proc/cgroups
, and the cgroup a process belonging to at /proc/<pid>/cgroup
.
"The systemd system and service manager is responsible for controlling how services are started, stopped and otherwise managed".
"...by binding the system of cgroup hierarchies with the systemd unit tree", "Therefore, you can manage system resources with systemctl commands, or by modifying systemd unit files."
The key systemd unit types related to cgroups are:
- Service - "A process or a group of processes, which systemd started based on a unit configuration file."
- Scope - "Scopes encapsulate processes that are started and stopped by arbitrary processes through the fork() function and then registered by systemd at runtime."
- Slice - "A group of hierarchically organized units. Slices do not contain processes, they organize a hierarchy in which scopes and services are placed. The actual processes are contained in scopes or in services."
- systemctl - Show, start, stop, enable, disable, ..., services
- journalctl - Show service log
- systemd-cgls - Recursively view cgroup contents
- systemd-run - Create transient cgroups
- systemd-top - View service processes
- https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/resource_management_guide/chap-introduction_to_control_groups
- https://access.redhat.com/articles/754933
- https://www.redhat.com/sysadmin/cgroups-part-one
- https://manpages.ubuntu.com/manpages/bionic/man7/cgroups.7.html
- https://manpages.ubuntu.com/manpages/bionic/man1/systemd.1.html