Skip to content

Runtime: coordinate GC, JIT, Wasm, and worker CPU budgets #502

Description

@chrisbbreuer

Parent: #459
Depends on: #476, #481, #482, #490
Related: #477, #478, #492, #503

Goal

Coordinate GC helpers, JIT/Wasm compilation, JavaScript Threads, Workers, waiters, and host tasks under explicit bounded CPU, memory, and latency budgets.

Problem

GC, native compilation, Wasm work, shared-realm Threads, isolated Workers, and benchmark workers make separate concurrency decisions. As parallel tiers land, independent pools/helpers can oversubscribe cores, steal latency from mutators, inflate RSS, or create priority inversions even when each subsystem is locally correct.

Scope

  • Inventory every engine-created thread/helper/pool, its ownership, lifecycle, blocking behavior, memory/scratch, affinity, priority, and participation in GC/JIT teardown.
  • Add a per-VM/process resource coordinator with configurable and automatically bounded CPU slots, compilation queue, GC helper count, worker admission, scratch/memory pressure, and shutdown.
  • Prioritize mutator progress, foreground latency, termination/debugger work, GC safety, and bounded memory over speculative compilation.
  • Prevent GC/JIT/Wasm helpers from deadlocking or starving when JavaScript threads block in Lock/Condition/Atomics.wait, host callbacks, join, or module loading.
  • Apply backpressure/cancellation to stale compilation and queued internal work with exact ownership and no partially published artifact.
  • Expose embedder controls and machine-readable scheduling decisions without making host thread handles cross-affine.
  • Benchmark dedicated and oversubscribed hosts, small/large core counts, mixed subsystems, and memory pressure.

No-workaround rules

  • No hardcoded benchmark core count, sleep/yield loop, hidden GIL, unbounded pool/queue, OS-priority abuse, dropped task, canceled required GC, or throughput result that silently starves latency work.

Acceptance

Foundation

Current pooling/scheduler guidance lives in docs/threads/production-readiness.md and docs/threads/limits.md; subsystem work is tracked by #476/#481/#482/#490.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestperformanceMeasured runtime, memory, scaling, or build performancethreadsNo-GIL threads, Workers, atomics, and shared state

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions