Why not Green Threads?
Posted
by
redjamjar
on Programmers
See other posts from Programmers
or by redjamjar
Published on 2011-11-17T21:38:17Z
Indexed on
2011/11/18
2:02 UTC
Read the original article
Hit count: 516
Whilst I know questions on this have been covered already (e.g. http://stackoverflow.com/questions/5713142/green-threads-vs-non-green-threads), I don't feel like I've got a satisfactory answer.
The question is: why don't JVM's support green threads anymore?
It says this on the code-style Java FAQ:
A green thread refers to a mode of operation for the Java Virtual Machine (JVM) in which all code is executed in a single operating system thread.
And this over on java.sun.com:
The downside is that using green threads means system threads on Linux are not taken advantage of and so the Java virtual machine is not scalable when additional CPUs are added.
It seems to me that the JVM could have a pool of system processes equal to the number of cores, and then run green threads on top of that. This could offer some big advantages when you have a very number large of threads which block often (mostly because current JVM's cap the number of threads).
Thoughts?
© Programmers or respective owner