LoginSignup
10
6

More than 5 years have passed since last update.

Stackful coroutine実装まとめ

Last updated at Posted at 2018-11-20

何回も調べて疲れたのでまとめる。

Coroutines

C

  • libcoro
    • ucontext.h
    • GPLとPermissive系(?)のデュアルライセンス
    • -DCORO_LOSER
  • coroutine
    • ucontext.h
    • libcoro似
  • libaco
    • 爆速(ベンチマーク参照)
    • X86のみサポート(2018/11/19現在)
  • libwire
    • IOや同期のためのユーティリティ付
    • libcoroベース

C++

Rust

  • May
    • Battery included
    • 下のライブラリ: generator-rs
    • x86のみサポート(2018/11/19現在)
    • "Don't exceed the coroutine stack. It will trigger undefined behavior."
  • coroutine-rs

Context switch

C

  • ucontext.h
    • 古代技術
    • 実装・性能が気になる

C++

Rust

おまけ

  • Go
    • スタックはひとつながり
    • Stackmapがあるのでmove可能
    • Work stealingスケジューラ
    • デフォルトスタックサイズは2KB
  • LLVM Coroutine
    • Stackless coroutine
    • アロケーションはヒープとスタック両方いける
  • C++ 20: Coroutines
    • C++++++++++++++++++++++++++++++++++++

その他

10
6
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
6