gitwtfhub

wtf is fiber?

kassane/fiber — explained in plain English

Analysis updated 2026-07-17 · repo last pushed 2024-09-04

2C++Audience · developerComplexity · 3/5StaleSetup · moderate

TL;DR

A C++ library for lightweight cooperative multitasking, letting a program run thousands of concurrent tasks in a single thread with very little overhead.

Mindmap

mindmap
  root((repo))
    What it does
      Cooperative multitasking
      Single thread concurrency
      Fast context switch
    Tech stack
      C++11
      Boost
      Zig build
    Use cases
      Game engines
      Trading systems
      Network servers
    Audience
      Developers
      Systems programmers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Build a game engine that runs AI, physics, and audio tasks concurrently in one thread.

REASON 2

Write a high-frequency trading system that switches between tasks with minimal latency.

REASON 3

Create a network server handling thousands of concurrent connections without OS thread overhead.

What's in the stack?

C++C++11Zig

How it stacks up

kassane/fiber9veedz/4leggedspiderbotcantaro86/time-series
Stars222
LanguageC++C++C++
Last pushed2024-09-042020-02-26
MaintenanceStaleDormant
Setup difficultymoderatehardmoderate
Complexity3/54/52/5
Audiencedevelopervibe coderdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · moderate Time to first run · 30min

Requires a C++11 compiler, the Zig build system mentioned in the repo isn't detailed in the README.

Wtf does this do

Boost.fiber is a C++ library that lets a program juggle multiple tasks at once within a single thread of execution. Instead of relying on the operating system to forcibly swap between tasks, which is expensive and unpredictable, this library lets each task voluntarily pause itself and hand control over to the next one. The result is a way to handle many concurrent operations with very little overhead. Under the hood, it works by taking a snapshot of exactly what the program is doing at any moment, things like CPU registers, the instruction pointer, and the stack pointer, and saving it. When a task yields, that snapshot is tucked away and another task's saved state is restored. This "context switch" is extremely fast, typically taking fewer than 100 CPU cycles compared to thousands of cycles for a traditional thread switch. It's designed to feel familiar to developers who have used standard threading libraries, offering similar classes and functions for managing and synchronizing tasks. Developers building high-performance applications, like game engines, real-time trading systems, or network servers, would use this when they need to run thousands of concurrent tasks without the heavy performance penalties of operating system threads. For example, a game might use it to run character AI, physics calculations, and audio processing side by side, where each task can politely step aside when it hits a natural stopping point. The cooperative model means the developer has precise control over when tasks switch, avoiding the unpredictable pauses that preemptive threading can introduce. The project requires a C++11 compiler or newer. The README doesn't go into detail about the specific Zig build system mentioned in the repository description, so the focus remains squarely on the core C++ library itself and its approach to lightweight, cooperative multitasking.

Yoink these prompts

Prompt 1
Show me how to create and switch between fibers using Boost.fiber's C++ API.
Prompt 2
Write a game engine loop that runs AI, physics, and audio as cooperative fibers with Boost.fiber.
Prompt 3
Explain how to synchronize fibers using Boost.fiber's mutex and condition_variable classes.
Prompt 4
Help me set up a C++11 project that uses Boost.fiber for lightweight concurrency.

Frequently asked questions

wtf is fiber?

A C++ library for lightweight cooperative multitasking, letting a program run thousands of concurrent tasks in a single thread with very little overhead.

What language is fiber written in?

Mainly C++. The stack also includes C++, C++11, Zig.

Is fiber actively maintained?

Stale — no commits in 1-2 years (last push 2024-09-04).

How hard is fiber to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is fiber for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.