cgroups experiment

# Yum install -y libcgroup libcgroup-tools 
create a control group
cgcreate CPU -g: / Test
cgcreate CPU -g: / test2

disable quota
cgset -R & lt cpu.cfs_quota_us = -1 Test
cpu.cfs_quota_us test2 = -1 -R & lt cgset

set the weight
-R & lt cpu.shares = 1024 test cgset
cgset -R & lt cpu.shares test2 = 1024

# CAT test.sh
! # / bin / SH
X = 0
the while [True]; do
   X = X + $. 1
DONE;

test
# cgexec - CPU G: / ./test.sh Test
# cgexec CPU -g: / test2 ./test.sh
were run three, cpu utilization is 1: 1
Test 512 configured
CPU usage is 1: 2

Guess you like

Origin www.cnblogs.com/mhc-fly/p/11409449.html