Tim Misiak built an experimental Rust operating system around actors: isolated components that receive messages in a mailbox. In DbgOS, he can update the code drawing a notes app and keep the note open. That also lets him try a fix without losing the app state that exposed a bug.

  • Each actor handles one message at a time. Handlers must finish within a time limit, and safe Rust actors don’t share writable memory.
  • To replace a module, the OS pauses message delivery to its actors and lets any running handlers finish. Rust type metadata tells it how to carry the old state into the new version.
  • Idle actors don’t need a saved thread stack. The tradeoff is that long computations, such as decompression, still have to be broken into chunks that yield control.

Caveat: Misiak demonstrates live replacement in his prototype. He doesn’t benchmark it against a conventional threaded OS.

The 120-comment thread on Hacker News fills in two design details and asks what the tradeoffs look like in practice.

What the thread adds

  • timmisiak — explains how tasks wait for replies without a dedicated thread: “Async here just gives you a nice state machine, not a message pump.”
  • tancop — suggests handing off message ownership to avoid copying. timmisiak replies, “I should have mentioned that ownership of messages is transferred.”
  • nxobject — recalls the burden of cooperative scheduling on classic Mac OS: “by the end I ended up simulating pre-emption by sprinkling calls to a routine” that checked the timer and yielded as needed.
  • nvarsj — found cross-actor debugging harder in Akka. fpoling offers a counterpoint: “a typical workaround is to log explicitly state transitions.”
  • abound — points to Oxide’s Hubris for a different choice: a message-passing OS that still supports preemptive multitasking.

From a 120-comment thread, in HN’s own order.