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.
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);
kqueue and epoll backends.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.
Shared loop thread
Dedicated 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-
01
Event polling
kqueueon Darwin orepollpluseventfdon Linux waits for sockets, file completions, timers, and cross-thread wakes. -
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.
-
03
Stackful contexts
Guarded
mmapstacks and a small register swap preserve locals, exception state, Ada task identity, and synchronous control flow. -
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_uringor 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| Concern | Contract |
|---|---|
| Compatibility | Undesignated tasks remain native; event machinery starts lazily. |
| Fairness | Scheduling within a group is cooperative, with explicit yield points. |
| Foreign calls | Blocking foreign work belongs on a native task or a dedicated group. |
| Compiler support | Only exact, versioned GNAT patch families are accepted. |
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