Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / March 2006

Tip: Looking for answers? Try searching our database.

multithreading

Thread view: 
hp - 09 Mar 2006 11:52 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.