wood burning stoves 2.0*
The moose likes Performance and the fly likes need more skill on dual cpu system? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "need more skill on dual cpu system?" Watch "need more skill on dual cpu system?" New topic
Author

need more skill on dual cpu system?

Jimmy Chen
Ranch Hand

Joined: Apr 11, 2005
Posts: 54
I just have aquestion.
Do I need do more on dual cpu system?
Does it run faster for single thread or more threads?

Just want to know,hehe

thanks!
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
In my opinion:

If you have no other applications taking up processor time, then a single-thread application will probably run at the same speed on one processor or two. However if other applications take up time, then a single-threaded application will probably benefit from two processors, because the other applications can run on one processor while your single thread takes the other processor. It has to do less sharing that way.

If you have a multi-threaded application, it's much more likely to run faster on two processors. Assuming the threads aren't spending most of their time waiting or blocking for some reason.

In general, writing multithreaded code takes more skill than single=threaded code. I don't think the number of processors makes much difference here. But there may be exceptions.


"I'm not back." - Bill Harding, Twister
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
In terms of Java each CPU would be running a separate JVM (normally). So multi-threaded code doesn't change. However if you design your application for multiple processors you are going to have to partition the workload somehow. In the simplest case each processor does exactly the same thing, just on different data (so some coordination may be required). In the more complicated case you are going to have to partition your task into multiple stages, where some of these stages have to happen in serial, while others can happen in parallel. The parallel stages you can distribute over multiple processors. However this requires that those stages communicate past the JVM/Process boundaries � so you have to employ inter-process communication (IPC) through shared memory, sockets, pipes, etc. Ultimately IPC can introduce blocking behavior and overhead that may negate any advantage that you may have gained from distributing the processing over multiple processors.

So yes, you will need more skill to develop a multi-processor (parallel) application and you need good judgment to decide whether the application of heterogeneous parallel processing is going to help.
[ May 19, 2006: Message edited by: Peer Reynders ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: need more skill on dual cpu system?