Mourning the loss of our friend, WhitPhil.
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
 
Linux and Unix
Tag Cloud
access audio black screen blue screen boot bsod connection crash dell desktop driver drivers dvd email error excel firefox hard drive hardware hijackthis internet keyboard laptop malware monitor motherboard network networking outlook problem ram recovery router safe mode screen slow sound spyware tdlwsp.dll trojan vba video virus vista vundo windows windows 7 windows vista windows xp wireless
Search
Search for:
Tech Support Guy Forums > Operating Systems > Linux and Unix >
Increasing RH 8.2 threads

Tip: Click here to scan for System Errors and Optimize PC performance
[ Sponsored Link ]

Closed Thread
 
Thread Tools
elg3ne's Avatar
Junior Member with 4 posts.
 
Join Date: Apr 2004
28-Apr-2004, 01:37 AM #1
Increasing RH 8.2 threads
Hi guys, I have RH 8.2 box with tomcat 5 & apache with latest java version...

I have a game running with java, & when the game hits its players limit sometime there is "java lang error"...

As far as I know linux has only 1028 thread limit... Now I want to increase the limit because java uses lots of threads...

Is there any one know how to increase the linux threads?

Thanks
tsunam's Avatar
Senior Member with 1,246 posts.
 
Join Date: Sep 2003
Experience: Linux~su
28-Apr-2004, 03:31 AM #2
Seems to be that within linux its based on the ammount of space you allocate to the thread creation within the -Xxm settings, seems to be part of it. Thats more of a patch type thing then a fix. To get it closer to max you'll have to basically manually edit a couple of files and then recompile the program to be used.

+ max user processes (use "ulimit -u" to adjust)
+ thread limit, this is calculated based on the amount of physical memory
(you can change it by editing /proc/sys/kernel/threads-max) (this is probably the easiest way to change it)
+ virtual memory. 32bit Linux by default allows 2GB virtual address space
in user application. Unless you specify a smaller stack size (-Xss96k
will do it), java will run out of virtual space in about 4000 threads
(default stack size is 512k, 2GB/512k = 4096, but notice that the
virtual memory is also used for C heap, library image, data segments, et al.)

thoses are the various answers i have run across. Basically you modify the stack size. change the max process's as you need. And you can modify the thread count within your kernel so that it'll allow more.

to increase the limits, you have to recompile glibc. Oh fun!.
And the patch is essentially two lines!. Woohoo!

--- ./linuxthreads/sysdeps/unix/sysv/linux/bits/local_lim.h.akl Mon Sep 4
19:37:42 2000
+++ ./linuxthreads/sysdeps/unix/sysv/linux/bits/local_lim.h Mon Sep 4
19:37:56 2000
@@ -64,7 +64,7 @@
/* The number of threads per process. */
#define _POSIX_THREAD_THREADS_MAX 64
/* This is the value this implementation supports. */
-#define PTHREAD_THREADS_MAX 1024
+#define PTHREAD_THREADS_MAX 8192

/* Maximum amount by which a process can descrease its asynchronous I/O
priority level. */
--- ./linuxthreads/internals.h.akl Mon Sep 4 19:36:58 2000
+++ ./linuxthreads/internals.h Mon Sep 4 19:37:23 2000
@@ -330,7 +330,7 @@
THREAD_SELF implementation is used, this must be a power of two and
a multiple of PAGE_SIZE. */
#ifndef STACK_SIZE
-#define STACK_SIZE (2 * 1024 * 1024)
+#define STACK_SIZE (64 * PAGE_SIZE)
#endif

/* The initial size of the thread stack. Must be a multiple of PAGE_SIZE.
* */

Now just patch glibc, rebuild, and install it. ;-> If you have a
package based system, I seriously suggest making a new package
and using it.

another way to do it.

as well here are a few links that explain it better then i can
http://www.jlinux.org/server.html (this one is the most comprehensive though and explains it all out for you ) So start here ^.^

Interestingly enough I actually found this informative, because there's no doubt times when we all hit a no more threads can be made.
__________________
Gentoo Developer, and 64bit os user

"In feeding Mother Nature, you are fed in return" - Tsunam (2005). Concerning water conservation, and raising water tables.

Last edited by tsunam : 28-Apr-2004 03:41 AM.
Closed Thread Bookmark and Share

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Smart Search

Find your solution!



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.

Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -5. The time now is 09:10 PM.
Copyright © 1996 - 2009 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.
Powered by Cermak Technologies, Inc.