Some generic questions about the virtual thread.
Alan Bateman
alan.bateman at oracle.com
Wed Nov 13 15:17:55 UTC 2024
On 10/11/2024 07:59, nadeesh t v wrote:
>
> :
>
>
> What is the reason behind making a virtual thread daemon thread?
>
> Does it mean we should use virtual thread only if we do not care about
> its completion before shutdown of JVM?
>
Most virtual threads will be started in some container, maybe with
thread-per-task executor, or maybe with structured task scope. So while
the Thread API is tempting to use directly, it's more likely that
frameworks or libraries start virtual threads in some container that
supports close or some other means to wait for specific threads to
terminate.
Virtual threads don't interact with the shutdown sequence, e.g. 100k
virtual threads blocked on sockets or channels, would you really want
the shutdown sequence to wait?
>
> IN JEP 444, I could see `The scheduler does not compensate for pinning
> by expanding its parallelism.` Is it based on the assumption that
> other tasks may wait for the same lock or is it because of some other
> technical reasons around pinning?
>
The Alternatives section in JEP 491 [1] says more about this, it's
basically that the number of carriers is limited.
-Alan
[1] https://openjdk.org/jeps/491#Alternatives
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20241113/bf52bdaf/attachment.htm>
More information about the loom-dev
mailing list