Questo contenuto non è disponibile nella lingua selezionata.
3.2.3. Example Usage
Example 3.2. Limiting CPU access
The following examples assume you have an existing hierarchy of cgroups configured and the
cpu
subsystem mounted on your system:
- To allow one cgroup to use 25% of a single CPU and a different cgroup to use 75% of that same CPU, use the following commands:
~]#
echo 250 > /cgroup/cpu/blue/cpu.shares
~]#echo 750 > /cgroup/cpu/red/cpu.shares
- To limit a cgroup to fully utilize a single CPU, use the following commands:
~]#
echo 10000 > /cgroup/cpu/red/cpu.cfs_quota_us
~]#echo 10000 > /cgroup/cpu/red/cpu.cfs_period_us
- To limit a cgroup to utilize 10% of a single CPU, use the following commands:
~]#
echo 10000 > /cgroup/cpu/red/cpu.cfs_quota_us
~]#echo 100000 > /cgroup/cpu/red/cpu.cfs_period_us
- On a multi-core system, to allow a cgroup to fully utilize two CPU cores, use the following commands:
~]#
echo 200000 > /cgroup/cpu/red/cpu.cfs_quota_us
~]#echo 100000 > /cgroup/cpu/red/cpu.cfs_period_us