LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Change kernel process number limits (http://www.linuxquestions.org/questions/slackware-14/change-kernel-process-number-limits-4175438629/)

linuxbird 11-25-2012 07:55 AM

Change kernel process number limits
 
I need to change the limits to the number of processes in Slackware 14, with the stock 32 bit kernel. Years ago this required a recompile of the kernel.

I am wondering if the (new) /proc feature (see how dated I am) or some other feature permits me to bump up the process limit on the fly.

Googling around, I find all kinds of reasons to have certain services limit the number of processes they can have, for security reasons, but I didn't stumble upon how to increase the limits for the kernel.

Didier Spaier 11-25-2012 08:08 AM

Check ulimit -h

linuxbird 11-25-2012 08:46 AM

Quote:

Originally Posted by Didier Spaier (Post 4836535)
Check ulimit -h

The issue is not user limits, but rather kernel limits. A ulimit of "unlimited" just takes one to the kernel limit, if one exists, as I recall.

jamesf 11-25-2012 09:13 AM

This thread is where I found the info: http://stackoverflow.com/questions/9...esses-in-linux

The answer there is:
Quote:

sysctl kernel.pid_max

or

cat /proc/sys/kernel/pid_max

As suggested by Ninefingers.

For completeness, you can change it temporarily by writing to /proc/syskernel/pid_max or permanently by adding:

kernel.pid_max = 4194303

to /etc/sysctl.conf. 4194303 is the maximum limit.
My upgraded-to-14 Slackware installation doesn't have a /etc/sysctl.conf, so I'm unsure what to do there. If creating one doesn't work then perhaps stuffing something like "sysctl -w kernel.pid_max=4194303" to rc.local, or perhaps "echo
>/proc/sys/kernel/pid_max 4194303" would work there as well. I dunno.

Good luck with it!

EDIT: When I tried the sysctl -w command on my 32-bit Slackware 14 it returned invalid argument errors for numbers > 32768.

EDIT2: Found the answer here: http://forum.soft32.com/linux/gentoo...ict333250.html
Quote:

On 9/16/06, darren kirby wrote:
> # sysctl -p
> error: "Invalid argument" setting key "kernel.pid_max"

You can find the answer in /usr/include/linux/threads.h.
PID_MAX_DEFAULT is defined as 0x8000 (32768) for most systems, and
PID_MAX_LIMIT is set to 4194304 *if* longs are larger than 4 bytes, or
PID_MAX_DEFAULT otherwise.

So if you are on a 32-bit system, you cannot set pid_max any larger
than PID_MAX_DEFAULT.

linuxbird 11-25-2012 05:23 PM

Thanks. How did you find that! I was looking all over stackoverflow, and found related stuff, but not that one. Looks like there might be another advantage of using a 64 bit kernel, if I understand the second part of your post correctly.

jamesf 11-25-2012 05:53 PM

Since you asked, I googled this phrase "linux kernel process number limit" and took a couple of the first hits (the list is different now, it would be the 1st and 3rd hits, I think).

Yes, 32768 seems the max for 32-bit kernels. You _could_ change it in the kernel source, but _I_ wouldn't try it since the setting is the single highest bit in a 32-bit word. I'd view that as probably related to word size and think that I'd likely break hard to find stuff somewhere else in the kernel.

YMMV, of course, and more searching might turn up a different answer.

good luck!

EDIT: I found the info for the second (32-bit limit) part by googling: "linux pid_max 32768 invalid argument"

Edit2: Note that if increasing the number of threads per process instead of the number of processes itself would help then this will tell you how to do it (NB: I haven't): http://stackoverflow.com/questions/3.../344292#344292


All times are GMT -5. The time now is 03:07 AM.