Vedhas Pitkar wrote:Does that mean a multithreaded application will behave differently on the OS'es you mentioned above?
A correctly written multithreaded application will work well on all platforms. However, there are some mistakes that are easy to make, and bad code may work on one platform and not on another. For example,
long assignment may be implemented as two separate 32-bit writes; depending on the VM and hardware, it may possible to read a half-written
long (if no correct synchronization is used; everything will work on all platforms if properly synchronized).
Playing with
thread priorities is another issue:
Java thread priorities must be mapped to the thread priorities supported by the underlying OS. If you rely on priorities in scheduling, you'll end up with a fragile, OS-dependent program.
A good book is Java Concurrency in Practice.