Interview Prep/Docker/Containers, VMs & Isolation Internals

Explain cgroups v1 vs v2.

IntermediateConceptContainers, VMs & Isolation Internals
Answer

v1 has a separate hierarchy per controller (/sys/fs/cgroup/memory/..., /cpu/...). v2 has a single unified hierarchy with one tree, better memory accounting (includes page cache and kernel memory), PSI pressure metrics and safe delegation to non-root users, which rootless containers need. Check with stat -fc %T /sys/fs/cgroup (cgroup2fs = v2). Modern distros (RHEL 9, Ubuntu 22.04+, Debian 12) default to v2.

All Docker questions Roadmap: Docker & containers

More on Containers, VMs & Isolation Internals