prometeu-studio/docs/specs/pbs/16. Runtime Execution and Initialization Specification.md

3.3 KiB

PBS Runtime Execution and Initialization Specification

Status: Draft v0 (Skeleton)
Applies to: runtime startup, entry behavior, module/service initialization, and execution lifecycle of PBS programs after successful load

1. Purpose

This document will define the runtime execution and initialization contract for PBS programs.

2. Scope

This document is intended to define:

  • entry and startup behavior,
  • initialization ordering relevant to PBS-visible semantics,
  • lifecycle of module-owned and service-owned runtime state,
  • execution boundaries before, during, and after frame-driven program operation,
  • runtime assumptions that are neither purely dynamic semantics nor purely loader behavior.

This document does not define:

  • loader-side host resolution,
  • full packaging format,
  • scheduler models outside v1 execution assumptions.

3. Authority and Precedence

Normative precedence:

  1. Runtime authority (docs/specs/hardware/topics/chapter-2.md, chapter-3.md, chapter-9.md, chapter-12.md, chapter-16.md)
  2. 1. Language Charter.md
  3. 6.2. Host ABI Binding and Loader Resolution Specification.md
  4. 9. Dynamic Semantics Specification.md
  5. 10. Memory and Lifetime Specification.md
  6. This document

If a rule here conflicts with higher-precedence authorities, it is invalid.

4. Normative Inputs

This document depends on, at minimum:

  • 1. Language Charter.md
  • 6.2. Host ABI Binding and Loader Resolution Specification.md
  • 7. Cartridge Manifest and Runtime Capabilities Specification.md
  • 9. Dynamic Semantics Specification.md
  • 10. Memory and Lifetime Specification.md

5. Already-Settled Inputs

The following inputs are already fixed elsewhere and must not be contradicted here:

  • FRAME_SYNC-based execution semantics are preserved.
  • Loader-side host binding resolution and capability gating happen before program execution begins.
  • Service values are canonical module-owned singleton values.
  • Top-level executable statements are forbidden in PBS source modules.

6. Initial Section Targets

At minimum, the completed document should contain normative sections for:

  1. execution entry assumptions,
  2. initialization ordering,
  3. service singleton runtime lifecycle,
  4. runtime frame and step boundaries,
  5. failure and non-start conditions.

7. A Ver

The following items remain to be closed in future agenda discussion.

  • Exact runtime entry contract between loaded artifact and PBS-visible program behavior.
  • Whether module initialization exists as a distinct semantic phase in v1 beyond load success.
  • When service singleton state becomes initialized and observable.
  • Which runtime lifecycle boundaries are observable to user code versus VM-internal.
  • Whether shutdown/finalization behavior has any PBS-visible contract in v1.

8. Non-Goals

  • Defining OS/process lifecycle outside Prometeu runtime authority.
  • Reopening the ban on top-level executable statements.
  • Designing a future async runtime.

9. Exit Criteria

This document is ready to move beyond skeleton status only when:

  1. runtime startup and initialization order are normatively described,
  2. service and module runtime lifecycle assumptions are explicit,
  3. execution lifecycle boundaries are aligned with dynamic semantics and runtime authority,
  4. the document no longer relies on unresolved A Ver items for ordinary v1 runtime startup behavior.