The Quasar instrumentation in my opinion is a pain. Out of the box you either get AoT instrumentation or you use Java agent command line option. Both were problematic for me in context of build processes, IDE support, etc. It's possible to do runtime instrumentation with no special command line option using the Quasar URL classloader and Ant task which scans classes to instrument.
No, you'd get a slow illusion of full concurrency. The JDK ditched green threads ages ago because native threads were far more robust.
While nearly every other Green Threaded language offered as an additional library/option. This hurt adoption. While Go just forces you to use Green Threading.
With an AOT option for Java, this becomes even more of an option.
Not in the slightest. why can't Java implement the same idea and
let all existing libraries benefit from it?
A laundry list of reason:1. Change what functions do and don't block can cause huge issues with down stream libraries/people who depend on system libraries behaving the same thing tomorrow as they did yesterday.
2. Refactoring all code around system calls so they never block.
3. Write a multi-core and multi-socket scheduler.
4. Write a scheduler to balance multi-core and multi-socket thread load.
5. Determine how you will do polling, and write a polling strategy to figure out what green threads are/are not blocked, then figure out how to communicate this information efficiently.
6. Repeat the above 5 steps for EVERY platform Java runs on.
The hotspot JVM will accept both -d32 (32-bit data model) and -d64 (64-bit data model) everywhere, but they will only work on certain platforms.
The language specification doesn't state anything about how threads should be scheduled.
There are actually a few embedded JVMs that might still offer it.
Not sure why I'm getting downvotes for just asking a question, I thought this place was about discussion of ideas.
If it's at the JVM level (with a command line option to change how threading is done such as -useGreenThreads") then it's transparent to all existing code. I can just use anything (such as existing JDBC library), increase threadpool to levels that would be considered "ridiculous" with current JVM threading system, and it would all work fine. No code changes necessary for existing libraries.
People do this in Python, but they do it in Python because
1) Python is dumb and has the GIL, much easier to hack in
2) They use reflection to change libraries, but it breaks anytime you would hit native C code. With Java trying to JIT everything, you are now having to change threading at the assembly level.
I think it is would be a ton of work to do at the base JVM level. If you look at the people behind the library I linked, it is many of the core Java people. They might have more insight on reasons why it won't work.
There's no way you would get a switch like that, because you interact with them differently. I wish greenthreads would not use "thread" in the name because it causes confusion like in your case.
You take the same code and run it with 3000000 green threads... you are still capped out at 32 things running at the same time. Your system can kinda sorta pretend to be more concurrent, but the actually concurrency is the same.
(Also, they're still concurrent, just not parallel: https://vimeo.com/49718712)