This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills: The software developer's life manual and have John Sonmez on-line!
See this thread for details.
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MultiThreading in java working in MultiProcessor

 
Yugandhar Reddy
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an application written in java
I am creating a pool of threads and executing a process on each thread.
If i create a single thread on single processor system and give the process on it, it is taking 30 sec.
if i create two threads on dual processor system and giving the process on each thread, it is taking 54 sec.
I want to know how the dual processor system works in case of multi threading.
Thanks for the help.
 
Dan Cranmer
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It might have to do with the platform and JVM you are using. I ran the following code on a 3 processor Sun, when only one thread is created I can only use 33.3% of the CPU, when 2 threads are created it starts to use 66.6% and when all 3 threads are started I use all available processors.
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can your process be easily divided? some processes do not lend themselves to speed-ups due to multithreading.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic