Symmetric Multiprocessing (SMP) development
 help / color / mirror / Atom feed
* How do I increase threads per user?
@ 2003-04-08 23:33 da_alchemist
  2003-04-16 22:11 ` Vladimir G. Ivanovic
  2003-04-17 15:14 ` Vladimir G. Ivanovic
  0 siblings, 2 replies; 4+ messages in thread
From: da_alchemist @ 2003-04-08 23:33 UTC (permalink / raw)
  To: linux-smp

OS: Linux (or Sun Linux)
Kernel: 2.4.9-31enterprise
Memory: 2GB
CPUs: 2
Java: 1.4.1_01

I have a dual processor Cobalt LX50 and I am running
into a thread limit with Java. No matter what I do
with the Java JVM parameters (heap and stack), I
cannot get any more than 949 threads. My "top" output
shows that I am no where near my memory capacity.
Below is a simple Java program (28 lines long) I have
used to test this limit. My question is simply how do
I go about increasing this limit. Is there some kernel
parameter I can set or maybe have to recompile into
the kernel? My /proc/sys/kernel/threads-max is 16383.
I do not believe my ulimit settings are the problem,
but I will post them anyway. The problem also occurs
on non-Cobalt (plain old PCs) uniprocessor machines
maxxing at about 1018 threads. 

[root]# ulimit -a core file size (blocks) 0
data seg size (kbytes) unlimited
file size (blocks) unlimited
max locked memory (kbytes) unlimited
max memory size (kbytes) unlimited
open files 1024
pipe size (512 bytes) 8
stack size (kbytes) 8192
cpu time (seconds) unlimited
max user processes 8191
virtual memory (kbytes) unlimited


/*******************************Sample java program
testing thread
limits***********************************************/
import java.util.Timer;
import java.util.TimerTask;


public class Reminder {
Timer timer;
static int cnt;


public Reminder(int seconds) {
timer = new Timer();
timer.schedule(new RemindTask(), seconds*1000);
}


class RemindTask extends TimerTask {
public void run() {
System.out.println("Time's up!");
timer.cancel(); //Terminate the timer thread
}
}


public static void main(String args[]) {
System.out.println("About to schedule task.");
cnt = 0;
while (true) {
new Reminder(0);
System.out.println("Thread #" + ++cnt + "
scheduled.");
}
}
}
/****************************************************************************************/


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How do I increase threads per user?
  2003-04-08 23:33 How do I increase threads per user? da_alchemist
@ 2003-04-16 22:11 ` Vladimir G. Ivanovic
  2003-04-17 15:14 ` Vladimir G. Ivanovic
  1 sibling, 0 replies; 4+ messages in thread
From: Vladimir G. Ivanovic @ 2003-04-16 22:11 UTC (permalink / raw)
  To: da_alchemist; +Cc: linux-smp

My understanding is that the 2.4 series kernels do not support many
running many threads at once. You can compile in support for NGPT
(http://www-124.ibm.com/developerworks/oss/pthreads/) with glibc 2.2
which will probably increase your ability to run many threads at once.

With the for the 2.5 series kernels (with glibc 2.3), NPLT
(http://people.redhat.com/drepper/nptl-design.pdf) is available.

--- Vladimir

------------------------------------------------------------------------
Vladimir G. Ivanovic                        http://leonora.org/~vladimir
2770 Cowper St.                                         vladimir@acm.org
Palo Alto, CA 94306-2447                                 +1 650 678 8014

>>>>> "da" == da alchemist <da_alchemist@yahoo.com> writes:

  > OS: Linux (or Sun Linux)
  > Kernel: 2.4.9-31enterprise
  > Memory: 2GB
  > CPUs: 2
  > Java: 1.4.1_01

  > I have a dual processor Cobalt LX50 and I am running
  > into a thread limit with Java. No matter what I do
  > with the Java JVM parameters (heap and stack), I
  > cannot get any more than 949 threads. My "top" output
  > shows that I am no where near my memory capacity.
  > Below is a simple Java program (28 lines long) I have
  > used to test this limit. My question is simply how do
  > I go about increasing this limit. Is there some kernel
  > parameter I can set or maybe have to recompile into
  > the kernel? My /proc/sys/kernel/threads-max is 16383.
  > I do not believe my ulimit settings are the problem,
  > but I will post them anyway. The problem also occurs
  > on non-Cobalt (plain old PCs) uniprocessor machines
  > maxxing at about 1018 threads. 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How do I increase threads per user?
  2003-04-08 23:33 How do I increase threads per user? da_alchemist
  2003-04-16 22:11 ` Vladimir G. Ivanovic
@ 2003-04-17 15:14 ` Vladimir G. Ivanovic
  2003-04-17 15:48   ` Earle R. Nietzel
  1 sibling, 1 reply; 4+ messages in thread
From: Vladimir G. Ivanovic @ 2003-04-17 15:14 UTC (permalink / raw)
  To: da_alchemist; +Cc: linux-smp

I compiled and ran the code you submitted below. All it does is count up
the number of threads that it has created:

   [160000+ lines of output deleted for brevity's sake]
   Time's up!
   Thread #85321 scheduled.
   Time's up!
   Thread #85322 scheduled.
   Time's up!
   Thread #85323 scheduled.
   Time's up!
   Thread #85324 scheduled.
   Time's up!
   Thread #85325 scheduled.
   ^C                     <---- I got bored here

Perhaps you intended to have something other than 0 as the argument to
the constructor of Reminder. Using 30, I can create ~1400 threads before
the VM crashes (Red Hat 8.0, 2.4.18-27smp, glibc 2.2.93cw, Sun Java
1.4.1_02).

How do you know that the thread limit you see is not actually some
limitation in the classes Timer or TimerTask?

--- Vladimir

P.S. Perhaps this email thread is best continued on the Java-Linux
mailing list (java-linux@java.blackdown.org) since it really has nothing
to do with Linux SMP.

P.P.S. Your Yahoo account is full, so mail to you bounces.

------------------------------------------------------------------------
Vladimir G. Ivanovic                        http://leonora.org/~vladimir
2770 Cowper St.                                         vladimir@acm.org
Palo Alto, CA 94306-2447                                 +1 650 678 8014

>>>>> "da" == da alchemist <da_alchemist@yahoo.com> writes:

  > OS: Linux (or Sun Linux)
  > Kernel: 2.4.9-31enterprise
  > Memory: 2GB
  > CPUs: 2
  > Java: 1.4.1_01

  > I have a dual processor Cobalt LX50 and I am running
  > into a thread limit with Java. No matter what I do
  > with the Java JVM parameters (heap and stack), I
  > cannot get any more than 949 threads. My "top" output
  > shows that I am no where near my memory capacity.
  > Below is a simple Java program (28 lines long) I have
  > used to test this limit. My question is simply how do
  > I go about increasing this limit. Is there some kernel
  > parameter I can set or maybe have to recompile into
  > the kernel? My /proc/sys/kernel/threads-max is 16383.
  > I do not believe my ulimit settings are the problem,
  > but I will post them anyway. The problem also occurs
  > on non-Cobalt (plain old PCs) uniprocessor machines
  > maxxing at about 1018 threads. 

  > [root]# ulimit -a core file size (blocks) 0
  > data seg size (kbytes) unlimited
  > file size (blocks) unlimited
  > max locked memory (kbytes) unlimited
  > max memory size (kbytes) unlimited
  > open files 1024
  > pipe size (512 bytes) 8
  > stack size (kbytes) 8192
  > cpu time (seconds) unlimited
  > max user processes 8191
  > virtual memory (kbytes) unlimited


  > /*******************************Sample java program
  > testing thread
  > limits***********************************************/
  > import java.util.Timer;
  > import java.util.TimerTask;


  > public class Reminder {
  > Timer timer;
  > static int cnt;


  > public Reminder(int seconds) {
  > timer = new Timer();
  > timer.schedule(new RemindTask(), seconds*1000);
  > }


  > class RemindTask extends TimerTask {
  > public void run() {
  > System.out.println("Time's up!");
  > timer.cancel(); //Terminate the timer thread
  > }
  > }


  > public static void main(String args[]) {
  > System.out.println("About to schedule task.");
  > cnt = 0;
  > while (true) {
  > new Reminder(0);
  > System.out.println("Thread #" + ++cnt + "
  > scheduled.");
  > }
  > }
  > }
  > /****************************************************************************************/


  > __________________________________________________
  > Do you Yahoo!?
  > Yahoo! Tax Center - File online, calculators, forms, and more
  > http://tax.yahoo.com
  > -
  > To unsubscribe from this list: send the line "unsubscribe linux-smp" in
  > the body of a message to majordomo@vger.kernel.org
  > More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How do I increase threads per user?
  2003-04-17 15:14 ` Vladimir G. Ivanovic
@ 2003-04-17 15:48   ` Earle R. Nietzel
  0 siblings, 0 replies; 4+ messages in thread
From: Earle R. Nietzel @ 2003-04-17 15:48 UTC (permalink / raw)
  To: Vladimir G. Ivanovic; +Cc: da_alchemist, linux-smp

On Thu, 2003-04-17 at 17:14, Vladimir G. Ivanovic wrote: 
> I compiled and ran the code you submitted below. All it does is count up
> the number of threads that it has created:
> 
>    [160000+ lines of output deleted for brevity's sake]
>    Time's up!
>    Thread #85321 scheduled.
>    Time's up!
>    Thread #85322 scheduled.
>    Time's up!
>    Thread #85323 scheduled.
>    Time's up!
>    Thread #85324 scheduled.
>    Time's up!
>    Thread #85325 scheduled.
>    ^C                     <-- I got bored here
> 
> Perhaps you intended to have something other than 0 as the argument to
> the constructor of Reminder. Using 30, I can create ~1400 threads before
> the VM crashes (Red Hat 8.0, 2.4.18-27smp, glibc 2.2.93cw, Sun Java
> 1.4.1_02).


Using 30 I created ~3660 threads before the VM crashed with an
OutOfMemory exception (RedHat 9, 2.4.20-9smp, Sun Java 1.4.1_02).

Remember you also have to think about how the kernel splits up memory
for user space and kernel space, I don't know how java implements its
thread environment so I can't speak intelligently on the subject.

-- 
Earle R. Nietzel <nietzel@rhinobox.org>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-04-17 15:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-08 23:33 How do I increase threads per user? da_alchemist
2003-04-16 22:11 ` Vladimir G. Ivanovic
2003-04-17 15:14 ` Vladimir G. Ivanovic
2003-04-17 15:48   ` Earle R. Nietzel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox