Skip to main content

Posts

Showing posts from 2015

CPU cgroup with sub group or sub directory

What happens when you have many levels of sub-directory of CPU cgroup? what's the expect behavior for each process inside or outside those sub-directory?  I hope this post helps. TL;DR When Linux scheduler processes, each cgroup with running processes will be considered as a single entity the same other processes at the same level.  Scheduler will assign CPU shares to each entity based on its weight (priority). Each group will then distribute CPU share to all processes and cgroups under it, follow the same rule Assumptions:  1. We have N running (running, not all) processes/threads all need lots of CPU (if there's on competition, then each process will get the CPU they need) 2. All processes have default priority/nice value 3. We only have 1 CPU (to make calculation simple) Case 1:   No sub-directory/sub-group (this is same as without CPU cgroup)  each process will get 1/N CPU time, so if N is 10, then each one will get 10% CPU Case 2:   create