-1

This question already has an answer here:

I execute below command:

ulimit -a

And it gives output as:

core file size          (blocks, -c) 0 
data seg size           (kbytes, -d) unlimited 
scheduling priority             (-e) 0 
file size               (blocks, -f) unlimited 
pending signals              (-i) 14881 
max locked memory       (kbytes, -l) 64 
max memory size     (kbytes, -m) unlimited 
open files                      (-n) 1024 
pipe size            (512 bytes, -p) 8 
POSIX message queues     (bytes, -q) 819200 
real-time priority              (-r) 0 
stack size              (kbytes, -s) 8192 
cpu time               (seconds, -t) unlimited 
max user processes              (-u) 14881 
virtual memory          (kbytes, -v) unlimited 
file locks                      (-x) unlimited

Question is: What happens once this limit reached ? How do I come to know that limit has been reached and now I need to execute some steps ?

e.g. If max-user-processes reaches 819200, then does it mean that new process will not start ? OR system will gracefully close most idle process to free up some space ? Or may be something else ?

The mentioned numbers/limitations does add any overhead to system performance ?

marked as duplicate by Stephen Harris, Community Aug 7 '18 at 15:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

-1

If allocating a resource on behalf of an application exceeds the resource limit on that application, then the resource allocation will fail. If the "max user process" value is N, and there are N processes running for the given user, then a call to the fork() (or related) system call will fail. If the "open files" value is M, and there are M open files, a call to the open() (or related) system call will fail.

The values don't add any overhead to system performance because the system is always monitoring the values.

-1

The output data you include is not the true resource limits since your shell cheats and adds many unrelated other stuff to this list.

If you like to see what are really resource limits, either use a shell that does not cheat, or check the file

/usr/include/sys/resource.h

and look for the RLIMIT_*entries in that file.

Now what happens if you reach a soft limit:

  • An ignorable signal is send to the process. The signals are:

    SIGXCPU SIGXFSZ

If the hard limit is reached, the process is killed.

Note that this does not apply to all limits. Check http://schillix.sourceforge.net/man/man2/getrlimit.2.html for a descriptin on what happens on each specific limit.

Not the answer you're looking for? Browse other questions tagged or ask your own question.