dcsimg
Threads vs. Processes
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Rajiv_Malhotra
Posted On:   Tuesday, September 24, 2002 05:40 AM

I wrote a java program that instantiated 5 threads. Each of the thread had its oun set of data to be read and processed. The same thing I tried by running 5 processes simultaneously. The program's were run on Solaris2.6. The performance gained through threads was negligible. In fact the time time taken by 5 threads was almost equal to the time taken by singke thread. On the contrary the running 5 processes reduced the total time by 1/5. The box on which i am running the application has 8 processors. Please suggest me why the threads didn't behave as desired. Also the same threaded program when run on NT reduces the time taken by 1/5. Is it the OS that is responsible for this, or probably there is some other reasonbehind ?? Your   More>>


I wrote a java program that instantiated 5 threads. Each of the thread had its oun set of data to be read and processed. The same thing I tried by running 5 processes simultaneously. The program's were run on Solaris2.6. The performance gained through threads was negligible. In fact the time time taken by 5 threads was almost equal to the time taken by singke thread. On the contrary the running 5 processes reduced the total time by 1/5. The box on which i am running the application has 8 processors.


Please suggest me why the threads didn't behave as desired. Also the same threaded program when run on NT reduces the time taken by 1/5. Is it the OS that is responsible for this, or probably there is some other reasonbehind ??

Your suggestions are welcome. Thanks

   <<Less

Re: Threads vs. Processes

Posted By:   Zac_Jacobson  
Posted On:   Tuesday, September 24, 2002 12:30 PM

A guess:

Your JVM is not set up to take advantage of multiple processors, so it runs as it would on a single-processor machine. When you start up multiple JVM instances, your OS farms these processes out to multple processors, hence the speed increase.

Look into getting your JVM to use multiple processors, I'm sure Sun has info on this for Solaris.

Re: Threads vs. Processes

Posted By:   Elliott_Frisch  
Posted On:   Tuesday, September 24, 2002 06:46 AM

Please see Sun for more information...
Try this:
export LD_LIBRARY_PATH=/usr/lib/lwp
before starting your program (if you need to make other alterations to the library path because your using JNI or some such then append them to that path).


Hope that helps,

Elliott
About | Sitemap | Contact