RFR: 8287496: Alternative virtual thread implementation that maps to OS thread
Alan Bateman
alanb at openjdk.java.net
Tue May 31 11:43:15 UTC 2022
On Sun, 29 May 2022 14:46:39 GMT, Alan Bateman <alanb at openjdk.org> wrote:
> This patch adds an alternative virtual thread implementation where each virtual thread is backed by an OS thread. It doesn't scale but it can be used by ports that don't have continuations support in the VM. Aside from scalability, the lack of continuations support means:
>
> 1. JVM TI is not supported when running with --enable-preview (the JVM TI spec allows for this)
> 2. jshell --enable-preview can't be used (as jshell uses the debugger APIs and so needs JVM TI)
>
> The VM option "VMContinuations" is added as an experimental option so it can be used by tests. A number of tests are changed to re-run with -XX:-VMContinuations. A new jtreg property is added so that tests that need the underlying VM support to be present can use "@requires vm.continuations" in the test description. A follow-up change would be to add "@requires vm.continuations" to the ~70 serviceability/jvmti/vthread that run with preview features enabled.
> Since the package `jdk.internal.access` is exported[1](#user-content-fn-1-97aea7d7960164849e591e42b91fb5c4) to the `java.management` module, this can use `MethodHandle`s obtained using the trusted lookup.
That export is for another reason, and probably should be re-examined so that java.base doesn't need to export this package to java.management. In any case, we expect there will be compiler support soon to allow java.management be compiled with code that makes use of preview APIs in java.base. That will at least us reference Thread::isVirtual from code.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8939
More information about the serviceability-dev
mailing list