menu
125 tokens

Workers

Worker-first, local-first, shared-nothing-first memory model.

Workers

  • JS/TS already has a strong worker-first story
  • already talked about local / shared heap split
  • shared memory across workers, local heap to each worker
  • (this is fortunate because it gives us the local managed/borrowed model we want)
  • retain local / worker isolation as the primary model
  • use Workers for structured concurrency
  • (maps to threads N:M)
src/worker.ds.ds
1import { spawn } from "destack:worker";2 3const worker = spawn((value: uint64) => value * 2);4const result = await worker.post(21);