Flyology Runtime: early preview

Hi there,

Long-time lurker. A few years ago, I was pondering whether it would make sense for Ada/GNAT to have tasks that wouldn’t just map 1:1 to OS threads. But it wasn’t quite economical to try that out at the time.

Recently, I’ve decided to close this open loop by running a quick experiment over the weekend – the result is a patched RTS and additional runtime primitives that provide lightweight tasks and asynchronous I/O to Ada users. So far, the results have been promising – the overhead of individual threads can be fairly high under high task concurrency, and lightweight tasks mitigate it. Best of all, this doesn’t automatically make all tasks lightweight. Instead, by default tasks remain “native” and lightweight is an opt-in pragma.

On top of that foundation, I’ve cobbled together some I/O (sockets, files, DNS) and additional higher-level libraries for HTTP server & client, Postgres BE/FE protocol, and such. Some performance measurements are fairly encouraging.

You can check it out at https://flyology.org – it’s still running 0.1-dev and is hosted on its own Alire index.

Would love your thoughts.

P.S. Take this with a grain of salt. I am not a longtime member of the Ada community, but I feel that Ada’s approach to tasking could benefit from adopting this approach to system engineering.

6 Likes

That is very interesting. I think there is a great need in stateful co-routines having a task interface. The application fields are

  • Asynchronous I/O used as if it were blocking, a call without all data yields
  • GUI event handlers
  • State machines
  • Interfacing single-threaded frameworks

Basically all event-driven architectures dealt with in a sane way.

2 Likes

Thank you.

I’ve been a long-time user of Erlang (though not recently), and that’s part of the inspiration. I’ve also used Rust with async quite a bit and spent a good amount of time with Go as well. These and other experiences have informed what I’d like to see.

I hope what I’ve put together is useful to others – I am already building some things on top of it, and some of the components are proving quite useful, even though they are still early.

2 Likes

Nice project. Would it be possible to use 3. Implementation Defined Aspects — GNAT Reference Manual 27.0w documentation instead of pragmas?

1 Like

I haven’t found a way outside of perhaps patching the compiler, which is outside of the scope here. I wish, though!