The moose likes Threads and Synchronization and the fly likes MultiThreading in java working in MultiProcessor Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "MultiThreading in java working in MultiProcessor" Watch "MultiThreading in java working in MultiProcessor" New topic
Author

MultiThreading in java working in MultiProcessor

Yugandhar Reddy
Greenhorn

Joined: Jun 10, 2002
Posts: 2
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.


Reddy
Dan Cranmer
Greenhorn

Joined: May 24, 2000
Posts: 24
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

Joined: Oct 05, 2001
Posts: 1158

Can your process be easily divided? some processes do not lend themselves to speed-ups due to multithreading.
 
IntelliJ Java IDE
 
subject: MultiThreading in java working in MultiProcessor
 
Threads others viewed
Thread Doubt
need more skill on dual cpu system?
Utilizing second processor
Dual processor utilization
Reading a large text file ,modifying it and writing it to another file
MyEclipse, The Clear Choice