[colug-432] ulimit

Rick Hornsby richardjhornsby at gmail.com
Mon Dec 19 15:26:34 EST 2011

On Fri, Dec 2, 2011 at 2:57 PM, Mark Aufdencamp <mark at aufdencamp.com> wrote:
> A helpful link:
> http://www.cyberciti.biz/faq/linux-increase-the-maximum-number-of-open-files/

Thanks.  That was one of the things I read before posting that got me
really turned around.  The language is very confusing, especially when
he says things like "75000 files normal user can have open in single
login session."  That makes it seem like it is almost a per-user
(per-session more specifically) limit.

Someone else said that the ulimit was a per-process restriction, and
this appears to be true. /proc/<pid>/limits confirms this.

Recompiling the kernel isn't an option, but it is good to know that
this is where the default of 1024 comes from.  Based on what folks
suggested here and additional research, /etc/security/limits.conf is
the place to set it.  Something that took me a while to get is the
soft/hard limits.  Unlike disk/printer quotas, these different limits
do not refer to warnings or other information that lets the user know
they're about to run out.  Rather, the hard limit is the
kernel-enforced maximum.  The soft limit can be set by the user, up to
the hard limit.  So maybe the hard limit is 1024, but they decide a
process has run away if it hits 128 open FDs.  That would be a use for
the soft limit.  I believe, like a pid's nice value, the user can
lower their own hard limit (priority), but once lowered, they cannot
raise it.

It does not, however, appear that it is possible to change the ulimit
of a currently running process.  When a process starts up, the
kernel(?) figures out what limits it should have, and those last for
the life of the pid.

ulimit is just one of those things that seems to be poorly documented
and not well understood.


More information about the colug-432 mailing list