I have 3 processes on a single core machine. Each process is exactly the same and burns CPU as fast as it can (tight loop). Two of them (A
and B
) are launched with cgexec in separate groups with shares set to 512 and 512. The third (C
) is launched regularly, not with cgexec.
Once all are up and running, C
gets 66% of the CPU while A
and B
split 33%. If I kill C
then A
and B
get 50% each (as expected).
Why does C
get 66%? I would have expected 33% each in this scenario, or maybe 50% (C), 25% (A) and 25% (B). 66% going to C
doesn't work out no matter how I do the math though.
In general, I want to understand how processes launched without cgexec
interact with processes launched with cgexec
when it comes to resource sharing (CPU in particular, but a more general answer would be appreciated if it isn't too complex).
top
and I believe they were started fairly simply from a command prompt:cgexec -g cpu:foo myprogram
and./myprogram
. It has been a while so I don't remember with certainty. – Micah Zoltu Feb 27 '16 at 18:28cpu.shares
is a very peculiar configuration option; I recommend splitting things up by CPUs if possible usingcpuset.cpus
instead. – Wildcard May 31 '16 at 21:27