Experimental GNAT runtime integration

Lightweight tasks for Ada.

Flyology adds an explicit lightweight execution lane to ordinary Ada tasking, without introducing a new async model. Selected tasks run cooperatively as fibers on shared event-loop threads. Rendezvous, protected objects, exceptions, and synchronous control flow continue to use Ada task semantics.

Lightweight task Waits without blocking its shared loop thread.
Native task Runs on its own pthread through stock GNARL.
connection.adb
task Connection is
   pragma Task_Info
     (Flyology.Lightweight_Task);
end Connection;

-- An ordinary synchronous Ada call.
Flyology.IO.Sockets.Receive
  (Socket, Buffer, Last, Timeout => 1.0);
ExperimentalEvaluate against the documented constraints.
Darwin + Linuxkqueue and epoll backends.
AArch64 + x86-64Small ABI-specific context switches.

Programming model

Native and lightweight tasks share Ada semantics.

An undesignated task stays native. Lightweight execution is explicit, captured at task creation, and integrated below GNARL task semantics.

01 / LIGHTWEIGHT

Shared loop thread

task A task B task C
scheduler poller
02 / NATIVE

Dedicated pthread

Ada task GNARL pthread

Runtime architecture

Each part has a separate responsibility.

The poller reports readiness. The scheduler chooses a runnable fiber. The context switch preserves its stack. GNARL continues to provide Ada task semantics.

Read the architecture guide
  1. 01

    Event polling

    kqueue on Darwin or epoll plus eventfd on Linux waits for sockets, file completions, timers, and cross-thread wakes.

  2. 02

    Cooperative scheduling

    Per-group priority queues and deadline heaps select ready work. A CPU-bound lightweight task must suspend, yield, or call a fairness checkpoint.

  3. 03

    Stackful contexts

    Guarded mmap stacks and a small register swap preserve locals, exception state, Ada task identity, and synchronous control flow.

  4. 04

    GNARL semantics

    Rendezvous, protected objects, activation, masters, abort, and task identity remain within the existing runtime rather than a parallel async language.

Task-aware I/O

Calls stay synchronous. A lightweight wait does not block its loop.

The same public operation works from either lane. Values, exceptions, retry deadlines, and ownership rules stay consistent while the waiting mechanism changes underneath.

  • SocketsReadiness-driven connect, accept, receive, and send.
  • FilesPOSIX AIO on Darwin; io_uring or native AIO on Linux.
  • TimersMonotonic deadlines in each group poller, with no timer thread.
  • DNSTask-aware UDP and TCP resolution without a resolver worker thread.
  • TLSProvider-neutral nonblocking steps, including an optional OpenSSL 3 adapter.

Boundaries

Experimental, with documented constraints.

Flyology does not claim hard real-time behavior, preemptive lightweight scheduling, or universal compiler portability. Runtime preparation fails closed when a host and GNAT release are not in the verified patch matrix.

Review current constraints
ConcernContract
CompatibilityUndesignated tasks remain native; event machinery starts lazily.
FairnessScheduling within a group is cooperative, with explicit yield points.
Foreign callsBlocking foreign work belongs on a native task or a dedicated group.
Compiler supportOnly exact, versioned GNAT patch families are accepted.
The Flyology flight mark

The name

A study of flight, revisited.

In 1828, Ada Lovelace studied bird anatomy, experimented with materials for wings, and planned a book she called Flyology. This project borrows that name for another study in making familiar forms move differently.

Read the historical source

Build your first lightweight task.