I would like to limit memory used by a process started through bash with the ulimit command on Linux. I was wondering what OS mechanism is used to support ulimit. In particular, is it based on cgroups?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The Linux API methods for getting and setting limits are getrlimit(2) and setrlimit(2)
Limits are managed within the process space. A child process will inherit the limits of its parent. Limits are part of the POSIX standard, so all POSIX compliant operating systems support them (Linux, BSD, OSX).
cgroups are Linux specific, and are not even required in a Linux install. I’m not sure if it is possible to manage limits with cgroups, but it would definitely be non-standard do to so.