Guides · 18

Concurrency

A Vyi program runs one thing at a time. The language and the standard packages have no threads, no async or await, no channels, no atomic operations, and no locks.

What that means for the programs you write today:

  • Your program runs from the start of main to its end, one statement after another. Nothing else runs alongside it.
  • A call that reads input or writes output, such as reading from stdin with @io, waits until it finishes before the next statement runs.
  • To do several jobs, do them one after another in a loop. To use more than one processor core, run several copies of your program as separate processes, started from a shell script or another tool.

Because nothing runs at the same time, a file-level mut variable is never read and written from two places at once.

This guide will cover concurrency once the design is settled and the compiler supports it.