A Rust library implementing safe, lightweight context switches, without relying on kernel services
Go to file
edef bb699c0f6e Allow inlining Generator::state 2016-08-13 12:52:12 +02:00
.travis/docs run on Travis CI container infra 2015-04-19 15:40:43 -04:00
benches Implement the safe Generator abstraction. 2016-07-17 13:55:56 -04:00
src Allow inlining Generator::state 2016-08-13 12:52:12 +02:00
tests Rewrite the FPE test to not use Context directly 2016-08-09 16:00:17 +02:00
.editorconfig add .editorconfig 2015-04-16 04:17:55 -04:00
.gitignore initial commit 2014-12-23 04:27:28 +01:00
.travis.yml add Travis CI IRC notifications [skip ci] 2016-07-17 20:25:44 -04:00
Cargo.toml Allocate guard page under existing stack, not in it. 2016-07-16 20:54:33 -04:00
LICENSE remove copyright years 2016-03-22 08:25:23 +01:00
README.md label the Travis/AppVeyor badges [skip ci] 2016-07-17 16:12:45 -04:00
appveyor.yml appveyor: generate a zip of target/ 2016-07-17 17:16:19 -04:00

README.md

travis appveyor rustdoc

libfringe

libfringe is a library implementing lightweight context switches, without relying on kernel services. It can be used in hosted environments (using std) as well as on bare metal (using core).

It provides high-level, safe abstractions:

  • an implementation of internal iterators, also known as generators, Generator.

It also provides low-level, very unsafe building blocks:

  • a flexible, low-level context-swapping mechanism, Context;
  • a trait that can be implemented by stack allocators, Stack;
  • a stack allocator based on anonymous memory mappings with guard pages, OsStack.

Performance

libfringe does context switches in 2.5ns flat on x86_64!

test swap ... bench:         5 ns/iter (+/- 1)

…and on x86:

test swap ... bench:         5 ns/iter (+/- 1)

Limitations

libfringe currently doesn't work on anything but x86 and x86_64, and is untested on anything but Linux.

Installation

libfringe is a Cargo package. It's not stable software yet, so you'll have to use it as a git dependency. Add this to your Cargo.toml:

[dependencies.fringe]
git = "https://github.com/edef1c/libfringe.git"

Feature flags

libfringe provides some optional features through Cargo's feature flags. Currently, all of them are enabled by default.

valgrind

Valgrind integration. libfringe will register context stacks with Valgrind.