Controlling the VirtualThread.scheduler
Ron Pressler
ron.pressler at oracle.com
Tue Jun 7 10:33:44 UTC 2022
Hi.
The plan is to ultimately allow custom schedulers, but we want to first let
the ecosystem learn about virtual threads and their uses with the default
scheduler.
— Ron
> On 7 Jun 2022, at 06:09, Peter Veentjer <alarmnummer at gmail.com> wrote:
>
> Is it possible to configure the Scheduler in the VirtualThread?
>
> I'm working on a thread per core design. Each CPU runs a (pinned) platform
> thread called the EventloopThread which runs the actual eventloop. And all
> VirtualThread created in the EventloopThread should be tied to their owning
> EventloopThread. They should never be allowed to run on any other thread.
>
> The constructor of the VirtualThread does allow for a scheduler to be
> passed, but it is private and on initial inspection, it seems there is no
> proper entrance to configure the scheduler. Either a null scheduler is
> passed or some 'test' instance. So as a consequence, it seems that
> VirtualThreads are always executed on an ForkJoinPool and hence can run on
> any Thread.
>
> Regards,
>
> Peter.
More information about the loom-dev
mailing list