Code Monkey home page Code Monkey logo

libcommunism's Introduction

libcommunism

libcommunism is a simple cooperative multithreading library. It implements the concept of CoThreads, which are lightweight streams of execution context switched in user space. Each CoThread has its own stack, which allows them to maintain implicit state between invocations. Control is passed cooperatively between threads, rather than preemptively as kernel threads are scheduled, hence the name.

The library has no external dependencies, besides a C++20 compiler and CMake 3.18. (Earlier versions of CMake will likely work, but were not tested. C++20 is required for native std::span support.)

More information is available on the project website.

Supported Platforms

Due to the nature of the library, some architecture specific code is required to implement context switching. Currently supported architectures and platforms are:

  • aarch64 (AAPCS)
  • amd64 (System V ABI)
  • amd64 (Windows ABI)
  • x86 (fastcall)
  • setjmp
  • ucontext

Support for additional platforms is relatively trivial to add, with only a few required methods.

Out of the box, the build system will autodetect the best platform implementation for the architecture and OS it is being built for. To override this behavior, you can set the PLATFORM_LIBCOMMUNISM variable.

Documentation

Documentation on the library can be autogenerated from the sources using Doxygen and is available here.

Tests

Some basic tests are implemented via Catch2 and can be built by setting the BUILD_LIBCOMMUNISM_TESTS option in the CMake configuration. Of particular interest may be the benchmark tests, which test the context switching speed.

libcommunism's People

Contributors

tristanseifert avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

musteresel

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.