views:

160

answers:

3

As what I know, Java is using operating system threads (in contrast to i.e. Erlang), that means that the threads created with Java on Windows and Linux may behave different.

Are there any differences on Java threads on Windows and Linux? What is the biggest difference? It's maybe only a difference in performance?

A: 

I have already used thread in both OS, and no differences for the java developer. :)

Victor
+10  A: 

This is a very general question, so I'll give a general answer.

Java switched from green threads, to native threads early in its development. This does not mean that threads created on Windows and Linux will behave differently as both platforms will utilize native threads in their respective JVM implementations.

The thread interface exposed to Java by each OS, and similarly the native interfaces to threading via pthreads and Windows threads are very similar.

The biggest differences with respect to threading on the two platforms are that all threads on Linux are a form of process. Windows treats threads and processes very differently.

In my personal experience, native threads on Windows are slightly more lightweight and may perform slightly better within single process applications. Correspondingly (and perhaps irrelevant), are that Windows processes are extremely heavyweight compared with their Linux counterparts.

Matt Joiner
A: 

JVM hide all OS differences to you...

as was previously answered the threads on windows are big heavyweight that linux ones.

by experience a heavy multi threading application could have some delays with automatic memory garbage collector and those can generate huge memory peaks.

Gustavo V