locus: How Monarch works

Hi 馃憢! locus is a small collection of comics about how Monarch works: the snakes, cogs and mailboxes behind the API, one idea per strip.

Start anywhere.

  1. No. 1 Rust owns the mailbox, Python owns the loop A queue plus a pipe byte joins them. The byte is only a hint; the queue is the truth.
  2. No. 2 Who owns the thread? Async: the thread lives inside the loop. Sync: the loop lives inside the thread, and only wakes up when called.
  3. No. 3 How handle.get() wakes up No asyncio loop, no pipe, no busy polling: a watch channel, a waker, and a blocked thread with the GIL released.
  4. No. 4 How await handle wakes the asyncio loop The byte wakes the loop; the token says which await completed. The Tokio observer never runs the Python coroutine.
  5. No. 5 A body future: Python in, Python out Both ends are Python. Rust holds one reference and reports that it is ready: the same reporting mechanism a native task uses.
  6. No. 6 How a sync actor works One Python thread owns the actor: callbacks run between messages, .get() borrows its cached private loop, and stop waits for Thread.join().