Skip to content

Concurrency model

dk1 uses one engine thread plus N worker threads:

  • All scheduler continuations and all build-state and trace-store mutations run on the single engine thread - exactly as dk0 runs everything, and exactly as a JavaScript event loop would. The worker pool only runs the blocking leaves: spawning an external process and waiting for it to exit.
  • Because the engine thread makes the same scheduling decisions as dk0, dk1 builds the same objects in the same order; parallelism only overlaps the timing of independent leaves. No locks are taken in the build core.
  • Interrupts (Ctrl-C / SIGINT, and SIGTERM) are handled on the engine thread
    • worker threads mask them - so the resumability trace-store flush still runs when a build is interrupted.