Can't yield from within an instance created by reflection
Øystein Myhre Andersen
o.myhre at gmail.com
Wed Apr 7 09:44:36 UTC 2021
Well, I use Object.wait to ensure only one coroutine is operating at a time.
How do I increase this maximum value ?
I will also try rewriting using java.util.concurrent locks
- Øystein
On Wed, Apr 7, 2021 at 11:17 AM Alan Bateman <Alan.Bateman at oracle.com>
wrote:
> On 07/04/2021 09:57, Øystein Myhre Andersen wrote:
>
> 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 ....
>
> Virtual threads are just objects in the heap and 1M virtual threads
> shouldn't be an issue. I suspect David is right that you've got threads
> pinned due to Java monitors and synchronization (you also mentioned
> "oversynchronization" in one of your mails). The scheduler is based on
> ForkJoinPool and it's setup to spin up additional underlying carrier
> threads to help when there are virtual threads blocked in Object.wait. The
> default maximum is 256. Can you say a bit more about the locking that you
> are using when the Simula coroutines are implemented with threads? Would it
> be hard to convert it to use java.util.concurrent locks?
>
> -Alan
>
More information about the loom-dev
mailing list