OxL Reference

8.1 Execution model

  • The unit of execution is the task: a lightweight coroutine with its own stack. Tasks run on a pool of OS threads (by default one thread per core) with work stealing.
  • An implementation SHOULD perform I/O through io_uring (Linux), kqueue (macOS/BSD), IOCP (Windows).
  • An implementation MUST preempt a task that runs without suspension points for more than 10 ms (the mechanism is implementation-defined).
  • Calls of blocking { … } and FFI functions without the attribute @nonblocking are executed in a separate pool of blocking threads.
  • @pinned on a function or actor binds the task to one thread (shard-per-core); such a task never migrates.

Implementation-defined. I/O backend and preemption (D-8051; DIV-035; D-1600..D-1604). This implementation: network and file I/O go through one process-wide io_uring (on kernels without it, or with OXL_NO_IO_URING=1, non-blocking sockets and one epoll thread; file operations without io_uring use a pool of blocking threads); kqueue and IOCP are not implemented. Preemption of tasks that run longer than 10 ms is done by a monitor thread and a signal; the preemption check sits on the back-edges of loops, and in an innermost loop at least once per 1024 iterations (D-8063; D-7680).

Implementation-defined. Stack overflow (D-8051; DIV-003; D-3562). The Standard is silent about stack overflow. This implementation: the task stack is 256 KiB, the stack of the root task main is 8 MiB; an overflow is a clean panic stack overflow (a message on stderr, exit code 101) rather than an abnormal termination of the process by a signal. The stack is not unwound (defer, destructors) because the stack is exhausted.

blocking-in-task

See also

Source: docs/spec/oxl-standard.en.md