Skip to content

[2.5-02] Exact backend: runner/toolexec module and the sched core #337

Closed

Description

@hmdsefi

Context

sched is the user-space scheduler that rewritten code calls instead of starting goroutines, locking mutexes or ranging over maps directly. It parks a goroutine at each scheduling point and lets the driver release one per pass with the seeded toolexec/release stream. It lives in the nested module runner/toolexec, so the root module keeps its dependency rule.

Goal

Create the nested module runner/toolexec and the sched core: points, Go, mutexes, OnceDo, Select, Keys, the rand helpers and the gap registry, with XTE-060's goroutine identity.

Scope

  • runner/toolexec/go.mod, go.sum (requires only github.com/hmdsefi/faultline and gograph).
  • runner/toolexec/sched/sched.go: Point, Go, Lock/Unlock, RLock/RUnlock/WLock/WUnlock, OnceDo, Select, Keys, Rand, RandV1, Gaps, and the internals Task 3 uses (self, point, park, wake, wakeIfInAttempt).
  • sched_test.go, contract_test.go, core_test.go.
  • Out of scope: the helpers for the new rewrite rows (2.5-03).

Acceptance criteria

  • The driver's Lock returns once the holder releases the mutex, even when the holder reaches a point first; no hang (AT-XTE-14).
  • A process holding a rewritten mutex across time.Sleep(time.Second) while an invariant locks it fails in under 20 s of wall time with §7's deadlock text (AT-XTE-15).
  • Calls from a goroutine outside the attempt's bubble return without parking and leave Pending() false (AT-XTE-16).
  • self reads the goroutine and bubble once per park, and wake fires only when the pending set can change.
  • From runner/toolexec: go vet ./... and go test -race ./... are green, plus FAULTLINE_CHECK_DETERMINISM=1 go test ./....

Implementation notes

  • The code comes from spike/exb at d91b8a7, file by file with git show, never by merging the branch.
  • sched takes Reset's caller as the driver; there is no OnDriver (XTE-060).
  • Review depth: two seats.

References

These paths are in the private planning docs (.helper/docs/, gitignored) in the maintainer's checkout.

  • Plan: .helper/docs/plans/phase-2/2.5-exact-toolexec.md, Task 2
  • Spec: .helper/docs/specs/exact-toolexec.md (XTE-001, XTE-051, XTE-060 to XTE-063, XTE-066 to XTE-070, AT-XTE-14 to AT-XTE-16)

Blocked by

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions