4 ms·
It was never like that. Threads have their own stack, but that's about it. They can access anything anywhere. Hence the current focus on concurrency using immut
by SanderMak 13y ago
It was never like that. Threads have their own stack, but that's about it. They can access anything anywhere. Hence the current focus on concurrency using immutable message passing mechanisms on the JVM (actors etc.)
- raverbashing 13y agoOr, to be more specific, what are the differences between thread handling under Linux and Windows regarding to the JVM? Threads in Linux (in general) are separate process that share memory space, in Windows it's different and they're "threads" being scheduled under a parent process.
- teraflop 13y agoWhat's the difference? In both cases, threads have their own stacks but share the rest of their address space. Is there a distinction other than terminology?
- raverbashing 13y agoAh apparently not so much http://stackoverflow.com/questions/3237701/do-threads-created-in-java-behave-differently-on-windows-and-linux http://stackoverflow.com/questions/3237701/do-threads-create... But I would say you would have definitely to watch for a) thread creation time and b) thread priorities (but for most of the applications these are not a problem)
- nl 13y agoThis doesn't answer your question, but I suspect you may have a hazy recollection of something called "green threads"[1]. Green threads existed in early versions of Java (Java 1.1 and below) back in the days when operating systems had trouble with spawning large numbers of threads from a single application. In the Java 1.1 & Linux 2.0 days you could get better Java performance by using green threads. That didn't last long, and around the time Java was being used for server-side applications it had mostly switched over to native threads. So far as your actual question goes: There is little difference between the Java threading implementation on Linux & Windows. [1] http://en.wikipedia.org/wiki/Green_threads#Green_threads_in_the_Java_virtual_machine http://en.wikipedia.org/wiki/Green_threads#Green_threads_in_...
- barrkel 13y agoI think it's just an ontological issue, as well as Linux having more flexibility in what a process can share with its parent (via clone() flags). The Linux scheduler schedules processes; the Windows scheduler schedules threads. Via clone(), Linux can create a process that shares almost everything with its parent, and thereby looks mostly like a Windows thread. With regards the JVM, there is little difference in this specific respect. The sync primitives available on each platform are a bit different though, as well as things like signals.