How does ulimit -v work on Linux?

I would like to limit the memory used by a process running through bash using the ulimit command on Linux. I was wondering what OS mechanism is used to support ulimit. In particular, is it based on groups?

+4
source share
3 answers

Ways to get and set Linux API limits getrlimit (2) and setrlimit (2)

Constraints are managed in the process space. The child process inherits the limits of its parent. Limits are part of the POSIX standard, so all POSIX compatible operating systems support them (Linux, BSD, OSX).

Groups are Linux specific and are not even required in a Linux installation. I'm not sure that you can manage limits using groups, but it will definitely be non-standard.

+2
source

"ulimit" is basically an anachronism. You should not have any real restrictions if you need resources, and there are better ways to set quotes if you want to limit resources.

Here is a good overview:

A few pages to look out for include:

+2
source

I use softlimit , part of the DJB daemontools .

For example, specifying something like softlimit -m 1048576 nautilus , the program (nautilus) will never exceed 1MiB of memory usage (which also crashes immediately in this case).

0
source

Source: https://habr.com/ru/post/1440424/


All Articles