cgroups (aka control groups) is a Linux kernel feature to limit, police and account the resource usage of certain processes (actually process groups). Compared to other approaches like the 'nice' command or /etc/security/limits.conf, cgroups are infinitely more flexible.

Control groups can be used in multiple ways:

create and manage them on the fly using tools like cgcreate, cgexec, cgclassify etc

Simple usage

Ad-hoc groups

One of the powers of croups is that you can create "ad-hoc" groups on the fly. In fact, you can even grant the privileges to create custom groups to regular users. Run this as root (replace $USER with your user name):

sudo cgcreate -a $USER -g memory,cpu:me

That's it! Now all the tunables in the group "me" are writable by your user: