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 Learn more about cgroups (Control Groups)
- cgroups Explained: Limiting CPU, Memory, and I/O With systemd Control groups are the kernel mechanism behind container resource limits, and you can use them directly on any service. Here is what cgroups v2 does and how to cap a process without writing a container.
- Linux Namespaces Explained: What a Container Actually Is A container is not a thing the kernel knows about. It is a normal process with a restricted view of the system, built from namespaces, cgroups, and a changed root. Here is what each piece does.
- ulimit Explained: Per-Process Resource Limits and Why Services Ignore Them Too many open files is one of the most common server errors, and raising the limit is more subtle than it looks. Here is how soft and hard limits work, and why the shell setting does not apply to your systemd service.