Can't yield from within an instance created by reflection

Øystein Myhre Andersen o.myhre at gmail.com
Wed Apr 7 08:57:13 UTC 2021


Is there a limit to the number of virtual threads ?

The error in my implementation of class Simulation occurs when I start
virtual thread number 257.

Is this just a coincidence or ....

- Øystein



On Tue, Apr 6, 2021 at 7:50 PM Ron Pressler <ron.pressler at oracle.com> wrote:

> I’d be interested to see how well this works with virtual threads, perhaps
> with a custom scheduler.
> Should be very similar to using continuations directly.
>
> As to continuations, the fact that they *can* work *some* of the time
> doesn’t mean we can expose them. Other
> times, they can break compiler assumptions and result in undefined
> behaviour.
>
> — Ron
>
> > On 6 Apr 2021, at 16:42, Øystein Myhre Andersen <o.myhre at gmail.com>
> wrote:
> >
> > As mentioned, I have implemented Simula's class Simulation. I have run
> > simulations with up to a million processes. I have done this both with
> > platform threads and with Continuations.
> >
> > The time consumption with platform threads increased exponentially
> > while Continuations only increased linearly.
> > Just so you know.
> >
> >
> > On Tue, Apr 6, 2021 at 5:10 PM Alan Bateman <Alan.Bateman at oracle.com>
> wrote:
> >
> >> On 06/04/2021 15:29, Øystein Myhre Andersen wrote:
> >>
> >> That's a pity to remove such a basic feature. I am working on an open
> >> source project to implement Simula using Java. As you probably know,
> Simula
> >> was a great inspiration to James Gosling when he defined Java. Kristen
> >> Nygaard and Ole-Johan Dahl strongly believed that basic concepts were
> the
> >> thing. And I see Delimited Continuations as an important basic concept.
> >> Simula introduced Quasi-parallel systems to define discrete event
> >> simulation. You want to use it for virtual threads but it is possible
> that
> >> there are somebody out there who will use it for eg artificial
> >> intelligence. Why stop that opportunity - I will use it to implement
> Simula
> >> coroutines ( QPS Sequencing).
> >>
> >>
> >> By the way, I have also written an implementation that uses
> >> oversynchronized threads. Platform threads works well but virtual
> threads
> >> do not. There is something wrong there. I will return when it has been
> >> analyzed more thoroughly.
> >>
> >>
> >> If you are interested, the Simula project can be found here:
> >>   https://portablesimula.github.io/github.io/ <
> https://urldefense.com/v3/__https://portablesimula.github.io/github.io/__;!!GqivPVa7Brio!JNUrhq9WTpQQqmLyjbcrT062Xy0A2NUQvg5fZuffY9p7H9dOD130REg_AxisbmwmpA$
> >
> >>
> >> Thanks for the link to the project implements Simula coroutines.
> >>
> >> Delimited continuations is a powerful primitive but not one that this
> >> project plans to expose at this time. One significant issue is that
> >> yielding on one thread and continuing on another would break the
> invariant
> >> that Thread.currentThread() doesn't change in a thread of execution.
> Thread
> >> locals, lock ownership and several other features would break. There is
> >> also the issue as to whether the control flow would be just too advanced
> >> for many developers. It might be that generators or some other feature
> that
> >> will use thread-confined coroutines but for now, our focus is on virtual
> >> threads.
> >>
> >> -Alan.
> >>
> >>
> >>
> >>
> >>
>
>


More information about the loom-dev mailing list