PID limits and bounded concurrency
The Linux PID controller limits tasks in a cgroup, including threads, rather than only application processes. --pids-limit sets a container task ceiling; it helps contain accidental runaway concurrency. A thread-heavy application needs capacity for its normal runtime overhead.
Worked example
This is an offline lesson. Scenarios are fictional and Docker commands are unexecuted. Any optional execution requires an approved disposable VM, a reviewed preloaded image with verified digest, blocked external access and appropriate resource limits. No resource exhaustion or host-policy change is required. Before any authorized optional observation, verify the effective daemon endpoint including overrides, exact object ID and observation window. Bound collection time and output bytes; do not generate resource pressure or export private telemetry. Mark unavailable measurements NOT RUN.
Fictional task budget--pids-limit=64base tasks=8workers=12, tasks per worker=3projected=44; spare=20Alternative workers=20 -> projected=68; exceeds budgetCount existing tasks and projected workers including their threads, not just process names. A creation operation can fail when the limit is reached, even if CPU and RAM remain available; the controller does not automatically terminate existing tasks to fit a lowered limit. Check pids.current, pids.max and event counter changes in the correct cgroup on a supported host. In practice thread pools, init helpers and health probes also need headroom. The example is a planning worksheet, not an instruction to create tasks until failure. The capacity calculation is floor((64 - 8 - 8) / 3) = 16 workers. A parent controller can further reduce available capacity. A failed task creation needs corroborating controller evidence rather than assuming every EAGAIN is caused by this limit.
Common mistake
A process list can understate thread consumption.
Manual practice
With 8 base tasks, 3 tasks per worker and a ceiling of 64, calculate the maximum worker count with at least 8 tasks of headroom.
Worksheet: lab-fixtures/docker-resource-management/04-pids/scenario.txt.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
PID limits and bounded concurrency — Knowledge check
Apply resource management reasoning in a fictional scenario.
What does a PID controller count?
How many tasks are projected with 8 base and 12 groups of 3?
What can happen when task creation hits the ceiling?