• Post Reply Bookmark Topic Watch Topic
  • New Topic

what is the Maximum number of threads we can create(urgent please)

 
Dinesh Jayaraj
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dear friends:
I am a student doing my project unfortunately
I am not able to complete my project so I wanted to show
a project which is my imaginative.
In the code below first it count the number
of urls in the DB then it will create that many number of threads
(FtpTest which extends Thread class)to download new files from each site(url) now my doubt is
1>what are the maximum number of threads we can create like this?suppose my database contains some thousands of urls is it
possible to create that many number of threads?
2>suppose iam creating an instance of java.util.Hashtable class in FtpTest class which extends Thread, then for each thread created in FtpMain,wheather new instance of hashtable is created or only single instance of hashtable is shared by all threads?

3>i want upadateCompareFile to be executed by only one thread, which update date in a file on the local hard disc how it can be done?.
I am in tension please anybody help me as much as possible i will be greatfull for them
and i will remember them.
thanx in advance.
dinesh

[This message has been edited by Dinesh Jayaraj (edited March 08, 2001).]
Dinesh,
Could you please use [ code] [ /code ] tags to format your code. Lookup the UBB Code hyperlink for further details.
Thanks.

[This message has been edited by Rahul Mahindrakar (edited March 09, 2001).]
 
Andy Ceponis
Ranch Hand
Posts: 782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I read somewhere(maybe the Just Java 1.2 book) that there is a common ceiling for thread creation. The author said 26. He said thats not the maximum that can be created, but that 26 is a convention that is sometimes followed. I also read that the author had created over 500 threads in a program of his(but he didnt attempt to run it, just wanted to see if it would work on his system). Im not sure if there is a "maximum" but i do that that creating thtreads is very expensive and taxing on the system. I doubt you could create hundreds of threads and get them to run without some type of very powerful machine.
As to your other points, i have no clue as i have never done anythign like that.Sorry
 
Jim Baiter
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1> It is platform dependent - usually 1K or 1024.
2> You are creating a new Hashtable for each thread.
3> I'm not sure exactly what you are saying - if you mean that you want the method to be executed only by one thread at a time make it synchronized.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!