Skip to content

Implementation of stackfull coroutine, scheduler, fiber, async mutex, wait group, strand in C++ and FASM.

Notifications You must be signed in to change notification settings

k-morozov/concurrency-runtime

Repository files navigation

Build

Concurrency runtime in C++

What I did?


Intro

I really wanted to understand how Go's runtime works. I suppose that the best way to research smth - write it by yourself. So this project is only my effort to understand it. This lib doesn't ready for production. For example I wrote specific context switching and I don't know how it works on Window/MacOS or another CPU arch. I try to write good unit tests with diffrent sanitizers and cases. However, I don't think it's enough. For example for simular project fault injection is a good way to found a conccurancy problem.

I must admit that every decision is made in the design of the system imperfectly. Every design is trade off.

When I work with this lib I understood that concurrency is really too hard.

Requirements

  • x86-64
  • Linux
  • Clang++18

How to build

You can find more information:

sudo apt-get install python3 python3-pip python3-setuptools python3-wheel ninja-build
python3 -m venv env
pip install -r requirements.txt
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
# /usr/bin/clang++ is clang++-18
conan install . -of=build --build=missing -pr:a=./config/debug_profile
meson setup --native-file build/conan_meson_native.ini build . --buildtype debug
meson compile -C build
meson test -C build

Bench

see here

Perf results

see here


What have I implemented?

Switch context

Main part for implementation stackfull coroutine.

Stackfull coroutine

My implementation of stackfull coroutine.

Executor

Scheduler, executor.

Fibers

Stackfull coroutine + Executor = Fibers. Im proud of async mutex, wait group, event.

Common components

P.S. Thanks for R.Lipovsky for his wonderfully program :)

About

Implementation of stackfull coroutine, scheduler, fiber, async mutex, wait group, strand in C++ and FASM.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages