Introduction
libaco - A blazing fast and lightweight C asymmetric coroutine library.
#
The nameThe code name of this project is Arkenstone π
Asymmetric COroutine & Arkenstone is the reason why it's been named aco
.
#
Supported systemsCurrently supports Sys V ABI of following
- Intel386
- x86-64.
#
Summary- Along with the implementation of a production-ready C coroutine library, here is a detailed documentation about how to implement a fastest and correct coroutine library and also with a strict mathematical proof.
- It has no more than 700 LOC but has the full functionality which you may want from a coroutine library.
- The benchmark part shows that a context switch between coroutines only takes about 10 ns (in the case of standalone stack) on the AWS c5d.large machine.
- User could choose to create a new coroutine with a standalone stack or with a shared stack (could be shared with others).
- It is extremely memory efficient: 10,000,000 coroutines simultaneously to run cost only 2.8 GB physical memory (run with tcmalloc, each coroutine has a 120B copy-stack size configuration).
The phrase "fastest" in above means the fastest context switching implementation which complies to the Sys V ABI of Intel386 or AMD64.
#
ContributeIssues and PRs are welcome πππ
See how to help us with the project.
#
Copyright and LicenseCopyright (C) 2018, by Sen Han <[email protected]>.
Under the Apache License, Version 2.0.
See the LICENSE file for details.