Hi,
I would like to know how multi-threading works on a
multi-processor machine(G4 power MAC).Do special commands have to be
given access multiple processors?
Generally, the Java VM will try to balance out the threads it has across
the available processors. It won't split a single thread, so running a
single-threaded Java application on a multi-processor machine is a bit of a
waste of time (the background threads, like the finalizer and the garbage
collector, don't make enough use of a processor's time to be called
'effective use').
From the programmers' perspective, all that needs to be done is ensure
that you have enough threads in your system to make use of what's
available. If you're trying to make optimal use of the available processing
power, Runtime.availableProcessors() will let you know what you have to
work with.
Finally, threading issues can bite you on a multi-processor system, so your
thread interaction must be *very* careful. Remember, now you have *true*
concurrency, with instructions executing side-by-side on the different
processors. Java's built in synchronization mechanisms will help here.
Hope that helps,
Danny.