Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I guess you haven't read the JLS.

There isn't any requirement for red threads in certified JVMs and a few of them do offer green threads, which is actually how the first versions used to do threading.



Well I meant that in regard to which JVMs people actually use...not what are theoretically possible.


Even then, Java's had ExecutorService, Callable<T> and BlockingQueue<T> for a long time. Effectively the same thing as Go's green threads from a programmer's perspective, with the only real difference being that Go swaps out an executing goroutine on I/O or other syscalls (or calling any C code).


Newer Go ersions will also preempt green threads on normal functions calls and not only on syscalls. Both is not possible with the JVMs primitives where you need "cooperative code".

However there exists Quasar for the JVM which seems to be able to emulate something similar to green threads with the help of bytecode weaving (and inserting preemption points).


Ok, fair enough, but if IO isn't happening, who cares if it's a runtime or the OS swapping out the 'thread'?


I was also talking about JVMs people actually use.

There is much more out there than OpenJDK and Oracle commercial JVM.

If you want a real product example,

http://www.is2t.com/products/specifications/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: