Interview Prep/Linux/Kernel Parameters, Namespaces & cgroups

What are cgroups, and how is cgroup v2 different from v1?

AdvancedConceptKernel Parameters, Namespaces & cgroups
Answer

Control groups organize processes into a hierarchy and apply resource accounting and limits (CPU, memory, I/O, PIDs). v1 had a separate hierarchy per controller, so a process could be in different trees for cpu and memory, leading to inconsistencies. v2 has a single unified hierarchy, better memory accounting (including page cache and kernel memory), PSI pressure metrics, and safer delegation. RHEL 9, Ubuntu 22.04+ and Debian 11+ default to v2.

stat -fc %T /sys/fs/cgroup     # cgroup2fs = v2
All Linux questions Roadmap: Linux

More on Kernel Parameters, Namespaces & cgroups