All Projects → ysbaddaden → muco

ysbaddaden / muco

Licence: other
Multithreaded Coroutines library

Programming Languages

c
50402 projects - #5 most used programming language
C++
36643 projects - #6 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to muco

May
rust stackful coroutine library
Stars: ✭ 909 (+4445%)
Mutual labels:  coroutines, fibers
Zewo
Lightweight library for web server applications in Swift on macOS and Linux powered by coroutines.
Stars: ✭ 1,856 (+9180%)
Mutual labels:  coroutines, fibers
Venice
Coroutines, structured concurrency and CSP for Swift on macOS and Linux.
Stars: ✭ 1,501 (+7405%)
Mutual labels:  coroutines, fibers
Umka Lang
Umka: a statically typed embeddable scripting language
Stars: ✭ 308 (+1440%)
Mutual labels:  coroutines, fibers
Taskscheduler
Cross-platform, fiber-based, multi-threaded task scheduler designed for video games.
Stars: ✭ 402 (+1910%)
Mutual labels:  scheduler, fibers
Fibertaskinglib
A library for enabling task-based multi-threading. It allows execution of task graphs with arbitrary dependencies.
Stars: ✭ 679 (+3295%)
Mutual labels:  coroutines, fibers
Boson
A C++14 framework for asynchronous I/O, cooperative multitasking and green threads scheduling
Stars: ✭ 154 (+670%)
Mutual labels:  coroutines, fibers
Elle
The Elle coroutine-based asynchronous C++ development framework.
Stars: ✭ 459 (+2195%)
Mutual labels:  coroutines, fibers
Concurrencpp
Modern concurrency for C++. Tasks, executors, timers and C++20 coroutines to rule them all
Stars: ✭ 340 (+1600%)
Mutual labels:  scheduler, coroutines
Minicoro
Single header asymmetric stackful cross-platform coroutine library in pure C.
Stars: ✭ 164 (+720%)
Mutual labels:  coroutines, fibers
asynchronous
A D port of Python's asyncio library
Stars: ✭ 35 (+75%)
Mutual labels:  coroutines, fibers
Marl
A hybrid thread / fiber task scheduler written in C++ 11
Stars: ✭ 1,078 (+5290%)
Mutual labels:  scheduler, fibers
Mioco
[no longer maintained] Scalable, coroutine-based, fibers/green-threads for Rust. (aka MIO COroutines).
Stars: ✭ 125 (+525%)
Mutual labels:  coroutines, fibers
Poseidon
Poseidon Server Framework (refactor WIP)
Stars: ✭ 162 (+710%)
Mutual labels:  coroutines, fibers
Swiftcoroutine
Swift coroutines for iOS, macOS and Linux.
Stars: ✭ 690 (+3350%)
Mutual labels:  scheduler, coroutines
AIO
Coroutine-based multithreading library for Delphi
Stars: ✭ 99 (+395%)
Mutual labels:  coroutines, fibers
Simple-Note-App-with-Online-Storage
✍️ Simple Note Making App use Sqllite Room 🧰 for caching the notes and 📥 Firebase Database for online storage
Stars: ✭ 42 (+110%)
Mutual labels:  coroutines
Automation-using-Shell-Scripts
Development Automation using Shell Scripting.
Stars: ✭ 41 (+105%)
Mutual labels:  scheduler
go-xxl-job-client
xxl-job go client
Stars: ✭ 36 (+80%)
Mutual labels:  scheduler
sched
In-process Go Job Scheduler. Supports Fixed, Timely, and Cron Expression Intervals. Instrument and Expose Scheduler's Job Metrics.
Stars: ✭ 57 (+185%)
Mutual labels:  scheduler

Multithreaded Coroutines (MUCO)

A working experiment at stackful coroutines that can be spawned, suspended and resumed by any thread; without sacrificing much performance.

Each thread has its own scheduler that first try to exhaust its own queue, then try to steal from a random scheduler. Schedulers' queue follow the "Scheduling Multithreaded Computations by Work Stealing" (1999) paper, with tweaks from the follow-up "Thread Scheduling for Multiprogrammed Multiprocessors" (2001) paper.

Most recently enqueued fibers are resumed sooner by the schedulers (to improve cache reuses) while the least recently enqueued fibers will be stolen by empty schedulers (to avoid starvation).

Thread-safe and fiber-aware synchronization primitives such as mutexes and monitors (condition variables) are available. An example channel implementation is also available, but limited to pass pointers and the overall performance is still quite poor.

Usage

See the samples and benchmarks directories for usage examples.

Notes

  1. Being multithreaded doesn't mean that an application performance will be improved.

    An application that switches contexts a lot, or doesn't need to communicate much between coroutines, or is CPU-bound will have better performance with many threads, because many fibers can be advanced in parallel.

    But an application that communicates a lot between coroutines and is mostly IO-bound can perform poorly with many threads, because the threads will have to synchronize a lot, which can significantly hinder performance.

  2. Starting more threads than available CPU cores/threads will perform better than starting less threads.

    I'm not sure about the reasons. Maybe this delegates more to the kernel, which does a better job at scheduling threads.

License

Distributed under the Apache 2.0 license.

References

Papers on-non blocking structures, shared-memory multiprocessor schedulers and synchronization primitives:

  • "Empirical Studies of Competitive Spinning for a Shared-Memory Multiprocessor" (1991)
  • "Simple, Fast, and Practical Non-Blocking and Blocking Concurrent Queue Algorithms" (1996)
  • "Scheduling Multithreaded Computations by Work Stealing" (1999)
  • "Verification of a Concurrent Deque Implementation" (1999)
  • "Thread Scheduling for Multiprogrammed Multiprocessors" (2001)
  • "An optimistic approach to lock-free FIFO queues" (2008)

Helpful code samples & thread synchronisation informations:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].