m³OS docs GitHub

Phase 42

Async Executor

Learn how Async Executor fits into m3OS.

Complete

Learning goal

Understand Async Executor in m3OS.

Category

infrastructure

Why this phase matters

Learn how Async Executor fits into m3OS.

How it works in m3OS

The roadmap entry defines the learning scope for this phase; a deeper implementation doc has not been matched yet.

How it builds on earlier phases

This phase builds on Crypto Primitives and turns that foundation into Async Executor.

Implementation outline

  • Implementation steps have not been extracted yet.

Task progress snapshot

0 of 94 tracked tasks are complete.

Documentation targets

  • Documentation deliverables have not been listed yet.

Deferred follow-on work

  • No deferred items were listed in the roadmap entry.

Source materials

Important code

Code spotlight cards

Code spotlight

Add `PollFd` struct and `poll()` wrapper to syscall-lib

userspace/syscall-lib/src/lib.rs See file

descriptors. Currently sshd inlines syscall3(SYS_POLL, ...) directly — a. Why it matters: The reactor needs poll() to block on multiple file. Focus on `PollFd` and `poll` in `userspace/syscall-lib/src/lib.rs` while you trace the snippet.

Code spotlight

Create async-rt crate skeleton

userspace/async-rt/Cargo.toml L5-L16

userspace daemon, not just sshd. The dual std/no_std feature flag pattern. Why it matters: A dedicated crate keeps the executor reusable by any. Focus on `async_rt` and `std` in `userspace/async-rt/Cargo.toml` while you trace the snippet.


[features]
default = ["std"]
std = ["libc"]
alloc = []

[dependencies]
syscall-lib = { path = "../syscall-lib" }
libc = { version = "0.2", optional = true }

[dev-dependencies]
libc = "0.2"

Code spotlight

Test and implement Task struct with woken flag

userspace/async-rt/src/task.rs L224-L232

waker.wake() when it has data ready, and the executor must know which task. Why it matters: The Waker is the core async primitive — sunset calls. Focus on `Task` and `task_waker` in `userspace/async-rt/src/task.rs` while you trace the snippet.

/// A single-threaded async task wrapping a future and its waker state.
///
/// This is a compatibility shim that wraps the new `TaskHeader`.
/// It will be removed when the executor is rewritten in Phase 2.
pub struct Task {
    #[allow(dead_code)]
    pub(crate) future: Pin<Box<dyn Future<Output = ()>>>,
    pub(crate) header: Arc<TaskHeader>,
}

Key files

How real OSes differ

Success criteria

Related phases

Keep exploring the roadmap