How to use cgroup in ubuntu 13.04
12,995
You need to be the owner of the tasks file as well so you have permission to write a pid to it. To do that, Use -t, e.g.,
sudo cgcreate -a $USER:$USER -t $USER:$USER -g cpu:ipeacocks
Related videos on Youtube
![ipeacocks](https://i.stack.imgur.com/usRZe.jpg?s=256&g=1)
Author by
ipeacocks
Updated on September 18, 2022Comments
-
ipeacocks almost 2 years
I'm trying to learn how
cgroup
works on Ubuntu and seems thatcgroup
doesn't work in Ubuntu 13.04. I am using the answer to this question How to set cpu limit for given process permanently. Cpulimit and nice don't workThese are what I've done:
-
Installed
cgroup
:sudo apt-get install cgroup-bin
reboot
-
Make a
cgroup
for your user (the owner of the process):sudo cgcreate -a ipeacocks -g cpu:ipeacocks
-
Ran the command:
echo 100 > /sys/fs/cgroup/cpu/ipeacocks/cpu.shares
-
And the command:
cgexec -g cpu:ipeacocks stress --cpu 4
and output:
cgroup change of group failed
Why? What I am doing wrong?
-
-
Rmano over 9 yearsyes, that was it. A pity I cannot mark at solved. @ipeacocks, would you?
-
Aquarius Power almost 7 yearsjust to help a bit
sudo cgcreate -a $USER:$USER -t $USER:$USER -g ...
-
Roland Pihlakas over 3 yearsI had to run additionally this command to make the error go away:
chmod 711 /sys/fs/cgroup/cpu,cpuacct
-
Admin about 2 yearsDidn't work on Ubuntu 22.04 which now has cgroups v2 unfortunately: askubuntu.com/questions/1406329/…