I want to use cgroups to limit resources in linux
http://en.wikipedia.org/wiki/Cgroups
How can I be notified when a limit if hit. For example if I limit a process to 2 gigs or ram how will I know when that is reached if I am not actively monitoring it?
cgroups support a Notification API as described here in section 2.4: http://www.kernel.org/doc/Documentation/cgroups/cgroups.txt
This guide has some good steps in writing a handler for the same:
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Resource_Management_Guide/sec-Using_the_Notification_API.html