Skip to content

t27: threads and async map to actors and structured concurrency (with a simulated scheduler) #9003

Open

Description

@gHashTag

Part of the effects-at-the-edge epic. Research basis:

  • Algebraic effects give async as a library: Microsoft Research, "Structured asynchrony with algebraic effects"; Ahman and Pretnar, "Asynchronous effects" (POPL 2021).
  • Effect handlers compose schedulers (ICFP 2022, OCaml workshop).
  • Repo rule: "Actors, not threads" (AGENTS.md; specs/queen/actors.t27).

Design:

  • Threads, channels and tokio tasks in source code map to actors and messages.
  • async/await maps to effect operations handled by a scheduler.
  • The scheduler for tests is the deterministic simulator (see the DST issue), which explores interleavings by seed.

Acceptance:

  • One concurrent Rust example (a channel-based worker pool) becomes actors in .t27.
  • It is checked under many seeds, with results equal to the oracle.

User Scenarios

  • Given a channel-based worker pool written in Rust using threads and channels, When it is expressed as actors and message passing in a .t27 spec and executed under the deterministic scheduler with varying seeds, Then all explored interleavings produce results identical to the reference oracle.

Requirements

  • FR-001: The .t27 spec MUST express the worker pool using actors and structured concurrency instead of OS threads.
  • FR-002: async/await operations in the spec MUST map to algebraic effect operations handled by the simulated scheduler.
  • FR-003: The deterministic simulator MUST explore interleavings by seed and produce results equal to the oracle for every seed.
  • FR-004: The spec MUST be checked under many seeds (at least 100) with all runs passing.

Success Criteria

  • specs/tri/net/async.t27 compiles with t27c and exits 0
  • The worker pool spec runs under the simulator with 100 seeds and all 100 runs exit 0 with oracle-equivalent results
  • t27c specs/queen/actors.t27 exits 0 confirming actor model conformance

Boundary

  • specs/queen/actors.t27
  • specs/tri/net/async.t27
  • AGENTS.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions