ATO: A Simple Task Async Runtime for no_std and no_alloc Environments
ATO is a minimal asynchronous task runtime designed for no_std and no_alloc environments, making it suitable for embedded systems, operating system kernels, or other resource-constrained applications where the standard library is unavailable.
It provides a basic task spawner and a round-robin scheduler to run Futures to completion.
Features
no_stdCompatible: Works in environments without the standard library.- No Allocator Needed: Designed to operate without dynamic memory allocation.
- Channels: Provides basic mpmc async channels for inter-task communication.
- Round-Robin Scheduling: Tasks are polled sequentially until completion.
- Simple Sleep Functionality: Includes an async
sleepfunction that requires a user-provided time source. - Fixed-Size Task Queue: Uses
heapless::Q*for a statically-sized task queue, configurable at compile time. - Simple Yield Functionality: Allows yielding control back to the scheduler, enabling cooperative multitasking.
Motivation
In many no_std contexts, a full-fledged async runtime like Tokio or async-std is too heavy or relies on
operating system features that aren't available. ATO aims to provide the bare essentials for cooperative
multitasking with futures in such environments.
Installation
Add ATO to your Cargo.toml:
[]
= "2.0.2" # Replace with the desired version
Basic Usage
Here's a basic example of how to use ATO:
const SPAWNER_SIZE: usize = 4; // Must be a power of two, e.g., 2, 4, 8, 16, etc.