Re:Another go at Go failed
by jamra on Wednesday January 08, 2014 @12:20PM
(#7024847)
I don't think there is anything wrong with Java as a language, but I have a question for you. Does Java's concurrency engine allow for many threads like Go or is it similar to C# in how your threads are not lightweight and are therefore limited to ixN where N is the number of CPU cores and i is a small integer < 10.
[ Parent
| on HN ]
The Java language specification does not define how threads are implemented.
The first set of JVMs did implement green threads, which are what goroutines are. Shortly thereafter most of them switched to red threads, aka real threads.
You can still find a few JVMs that use green threads, like Squawk.
https://java.net/projects/squawk/pages/SquawkDesign
Other than that, java.util.concurrent provides mechanisms to map multiple tasks to single OS threads.
You can't spawn 80 1:1 pthreads on an 8-core machine? Huh?
Operating systems have been able to handle an order of magnitude more pthreads than that since the day pthreads were introduced.
Java doesn't have a "concurrency engine", but a very large set of concurrency primitives: schedulers, locking and lock-free data structures, atomics etc.
To answer your question, yes: my own library, Quasar[1], provides lightweight threads for Java.