Skip to content

Fiber

Category: Units of execution · Status: stub

One line: A coroutine with its own stack that is switched to explicitly — the building block several green-thread runtimes are made of.

Also called: stackful coroutine.

How it connects

flowchart LR
  n_coroutine["Coroutine"]
  n_fiber["Fiber"]
  n_fiber -->|is a| n_coroutine
  classDef center stroke-width:3px
  class n_fiber center
  classDef outside stroke-dasharray: 4 3
  class n_coroutine outside

In each language

The operating system Fibers ↗ in the Windows API; POSIX removed makecontext and swapcontext from the standard
Elsewhere Ruby's Fiber, and PHP's Fibers ↗ since PHP 8.1

Where to read more