An OS with no threads: The Actor Model timdbg.com · 52 points · 12 comments · HN...
HN Best 200 @best
An OS with no threads: The Actor Model timdbg.com · 52 points · 12 comments · HN thread
TL;DR Tim D. B. G. (author of the DbgOS blog) describes his hobby OS written from scratch in Rust, where the only unit of concurrency is the actor model: isolated actors with mailboxes, no threads, no locks, no shared writable memory. The design gives him hot-swapping of modules without losing state, at the cost of manual cooperative structuring of CPU-heavy work. The post argues the tradeoffs are worth it for exploring OS design, not for replacing mainstream OSes.
- DbgOS is built from scratch in Rust; modules are ELF binaries whose metadata (via a derive(Schema) macro and a module! macro) describes actors and serializable types.
- Each actor has Args, Msg and state types, handles one message at a time, and cannot block; async tasks return results to their parent actor via a reply slot.
- Handlers are time-limited and the kernel kills instances that exceed the limit; there are no writable segments, no locking primitives and no shared writable memory.
- Because handlers never block and actors hold partitioned data, the OS can swap a whole module safely by waiting for in-flight handlers to finish, then migrating persisted data using schema metadata.
- The author says an idle actor needs no stack or register context, while a thread costs roughly 30-70KB idle, and argues LLMs can help write the manual state-machine style code.
- Hot swap is used in practice: UI, graphics and storage drivers and apps can be replaced without reboot, which the author finds useful when an LLM agent iterates on code.
Discussion The thread is a mix of technical questions and historical comparisons. Commenters with prior experience share a related design they built, probe how the model handles crashes mid-write, scheduling across cores and shared hardware contention, and recall the old Torvalds-Tanenbaum microkernel debate and Alan Kay's ideas about message passing. The mood is curious and mostly constructive, with a few skeptical notes about complexity moving into message channels.
- Actors should use linear ownership transfer for large data (a few): tancop suggests extending messages with linear types so ownership of a buffer moves to the receiver. This avoids copying, keeps the one-writer rule, and lets a pipeline of actors process files with memory use close to a monolithic program.
- Actor-based OS with persistence and capabilities is viable (a few): MarceColl describes a similar prototype where each actor's storage is saved after every update, actors hibernate when idle, and capabilities are just actor addresses that can be narrowed by wrapping them in restricted actors.
- Crash and partial-write recovery is unclear (some): frumiousirc asks what happens when a killed handler was mid-write to a file, and whether the work is retried without corruption. The post does not address this, and the commenter also asks how multi-threaded Linux apps coexist with the model.
- Message passing just moves complexity elsewhere (some): mrkeen recalls the classic microkernel critique: small modules are easier to reason about, but the complexity shifts into the communication channels. Several commenters see this as the historical debate resurfacing.
- Microkernel ideas have already largely won (a few): pjmlp argues most non-BSD/Linux OSes are hybrids with many userspace drivers, microkernels dominate embedded RTOS work, and hypervisor-based cloud stacks already resemble microkernel architecture.
- Hardware scheduling questions are unanswered (a few): thornjm asks whether there is one process per core, whether a single queue is shared across cores, and how two network or filesystem actors contend for the same hardware. These questions are asked from a position of acknowledged unfamiliarity.
Links from the comments
- Source repository of MarceColl's actor-based OS prototype, KokoroOS.
- MarceColl's Bluesky post with a picture and further explanation of the system.
#actorModel #operatingSystems #rust #concurrency #hotSwap #microkernel