Cgroup hierarchy and effective resource limits
Worked example
This is an offline lesson. Data are fictional and Docker commands are unexecuted. Any optional execution requires an authorized disposable VM, a verified context, synthetic data, restricted access and no external transmission. Do not collect secrets or private output. Treat the worksheet as offline evidence. Before any separately authorized server query, verify the effective endpoint and its trust boundary, including context overrides. Do not change runtime state, mount host data or modify Desktop settings in this exercise.
Synthetic cgroup v2 tree (MiB):/team memory.max = 536870912 (512 MiB)/team/app memory.max = 805306368 (768 MiB)/team/worker consumes 128 MiB (simplified accounting)/team/app cpu.max = 50000 100000Read-only self observation (Linux):cat /proc/self/cgroupThe app has a 768 MiB configured leaf cap but its ancestor has a 512 MiB aggregate cap. With the simplified assumption that the worker uses 128 MiB of that budget and nothing else is charged, at most 384 MiB remains for the app. Actual allocations depend on reclaim, other charges and concurrency. The CPU quota permits 50,000 microseconds of CPU time per 100,000 microsecond period (0.5 CPU-equivalent on average), not a dedicated half core. Memory, CPU and pids controllers are distinct. A cgroup namespace can change the displayed path without changing the ancestor restrictions. Read-only /proc/self/cgroup describes membership; it does not alone identify all effective limits. Controller availability and delegation depend on the host. The variation leaves 312 MiB under the parent budget, below the 768 MiB leaf cap. This is hypothetical headroom, not a reservation or a guarantee of allocation. CPU quota can be used across several CPUs within a period.
Common mistake
Do not interpret a leaf setting as a guaranteed reservation or write to cgroup files to test this example.
Manual practice
Calculate remaining memory when the worker consumes 200 MiB. Explain the difference between the cgroup path and the effective ceiling.
Worksheet: lab-fixtures/docker-container-internals/02-cgroups/scenario.txt.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Cgroup hierarchy and effective resource limits — Knowledge check
Interpret synthetic runtime and isolation evidence and explain kernel and OCI boundaries.
What is the maximum aggregate memory under /team?
With 200 MiB charged to the worker, what remains in the simplified parent budget?
For cpu.max 50000 100000, what CPU-time bandwidth does the quota allow on average?