hi all,
i have a doubt, i am using linux os with 2GB harddisk with P4 processor
how many threads can my java program handle at a particular point of
time.
plzzz i need the reply as soon as possible .
thanks in advance
byeee
Bart Cremers - 09 Mar 2006 12:23 GMT
As said in your other post, there is no fixed answer. The best way to
get an answer for your system is the write a small test program
spawning threads, until the system breaks.
public class ThreadSpawn implements Runnable {
public static void main(String[] args) {
for (int x = 1; x < Integer.MAX_VALUE; x++) {
System.out.println("Spawning thread " + x);
new Thread(new ThreadSpawn()).start();
}
}
public void run() {
try {
Thread.sleep(Integer.MAX_VALUE);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
Shut down as much processes as possible on your system and run this
program. This will give you a rough answer. Mine broke after 7122
threads.
Regards,
Bart