lilos

A wee RTOS using `async` Rust.

Quick links:

Now that Hubris has gotten some attention, people sometimes ask me if my personal projects are powered by Hubris.

The answer is: no, in general, they are not. My personal projects use my other operating system, lilos, which predates Hubris and takes a fundamentally different approach. It has dramatically lower resource requirements and allows more styles of concurrency.

A brief summary

lilos is an embedded operating system written in Rust and designed to power Rust-based firmware. lilos is focused on applications that need to do many things independently and concurrently – managing many streams of data, say, or processing events from lots of hardware interfaces. Instead of conventional threads, lilos uses the Rust async fn feature to transform code into state machines that can be executed from a shared stack.

I’m proud of the fact that lilos is, as far as I’m aware, the first and only Rust async runtime with an entirely cancellation-safe API!

Currently, lilos supports ARM Cortex-M-series microcontrollers, though I intend to port it to RISC-V as soon as I find a good dev board.

I’ve had lilos deployed in applications since mid-2019, running continuously. A typical application of mine has between 4 and 16 separate tasks, running in around 8 kiB of RAM on an inexpensive microcontroller, and processing hardware events with tight and predictable response times (typically in the tens of microseconds). To do that with a conventional operating system, you’d either need more RAM, or you’d have to unroll your concurrent program into a great big state machine by hand. lilos and Rust work together to build that great big state machine for you, making the code easier to write, read, and maintain.

lilos has been used for:

Where to learn more

I’ve already written a lot about lilos, so for now I won’t try and repeat it all here. Instead, here’s a curated set of links if you want to learn more about the system or try it out yourself.