4 ms·
The actor itself can be said to be waiting. When it yields, the thread is then able to run another actor which was waiting on a message, and which then has a me
by d4ng 3mo ago
The actor itself can be said to be waiting. When it yields, the thread is then able to run another actor which was waiting on a message, and which then has a message on the queue.
- mgaunard 3mo agoThat sounds like a misunderstanding of how the actor model works. An actor doesn't wait. It's an event-driven system, it doesn't get to own and decide when messages get fed to it.
- d4ng 3mo agoAre there any actor system implementations that you know of that work differently?
- mgaunard 3mo agoWell in mine for example, threads are pinned to a core and always spin, and actors are pinned to a given thread (you can have an arbitrary number of actors per thread, they're just objects), so "waiting" is certainly not something you'd use to describe the setup in any capacity.
- d4ng 3mo agoWhat happens when there are no messages on the queue for a given actor?
- mgaunard 3mo agoAn actor does not have a queue; that's again the whole point I already made: it's event-driven, things are decoupled and the actor is not aware of how control flow happens. Regardless, when the queue which exists and is per-thread is empty, the program terminates.