whatis cgroups

cgroups (Control Groups)

Also known as: control groups, cgroup v2

A kernel feature that groups processes and limits, accounts for, and isolates their CPU, memory, I/O, and process counts.

What Are cgroups in Linux?

cgroups let you say "this service may use at most 2 GB of RAM and half a CPU". systemd places every service, user session, and container in its own cgroup, which is how it tracks all of a service's child processes.

Containers rely on cgroups for resource limits, alongside namespaces for isolation. Modern distros use the unified cgroup v2 hierarchy mounted at /sys/fs/cgroup.

Example

systemd-cgtop
sudo systemctl set-property myapp.service MemoryMax=2G