Junior — Middle
How does the system react if CPU usage in a container exceeds the set limit?
sobes.tech AI
Answer from AI
If a process in a container exceeds the set CPU usage limit, the system (for example, Docker with cgroups) restricts its access to processor time.
In Linux, cgroups set CPU quotas, and when a process exceeds the limit, the kernel lowers its execution priority, slowing it down. The process will not be automatically killed, but its performance will decrease.
For example, if a container is allocated 50% CPU, and a process tries to use more, the system will limit it, giving access to CPU no more than 50% of the time.
This allows isolating containers and preventing one from consuming excessive resources.