Linux OS Internals (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)
What are Control Groups (Cgroups v1 vs v2) and how do they enforce resource limits?
senior Levellinux-osAdvanced Internals
In Simple Words: While Namespaces control what a process can see, Cgroups control how much resources a process can consume:
- Limits Enforced:
- Memory (
memory.max): Hard RAM limit; exceeding it triggers the OOM killer on the container. - CPU (
cpu.max): Enforces CFS bandwidth quotas (e.g. 2 cores =200000 100000). - I/O (
io.max): Throttle read/write bytes per second and IOPS.
- Memory (
- Cgroups v2 (Modern Standard): Replaces multiple fragmented v1 controller trees with a unified, hierarchical single-tree hierarchy, eliminating memory-pressure deadlocks.