Skip to content

Instantly share code, notes, and snippets.

@gleicon
Created February 14, 2012 23:17
Show Gist options
  • Save gleicon/1831533 to your computer and use it in GitHub Desktop.
Save gleicon/1831533 to your computer and use it in GitHub Desktop.
cgroups for debian/ubuntu
$ uname -a
Linux labs 3.0.0-12-generic-pae #20-Ubuntu SMP Fri Oct 7 16:37:17 UTC 2011 i686 i686 i386 GNU/Linux
(vanilla kernels after .39 already have everything for cgroups, RH backported it to .35 IIRC)
# http://www.mjmwired.net/kernel/Documentation/cgroups/memory.txt
# apt-get install cgroup-bin
# reboot
login, etc..
# adduser elmer
# cgcreate -a elmer -g memory,cpu:elmer
test - limit the
# echo 10000000 > /sys/fs/cgroup/memory/elmer/memory.limit_in_bytes
as the user
$ cgexec -g memory:elmer python
>>> import Queue
>>> c=[Queue.Queue() for a in xrange(1000000000)]
Killed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment