This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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.
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 ]