Giter Club home page Giter Club logo

hyperloop's Introduction

Hyperloop

Hyperloop is a priority based async runtime targeting embedded systems written in Rust.

Project aims

  • Provide a lean async runtime suitable for resource constrained microcontrollers.

  • No heap allocations.

  • No critical sections, using atomics for all synchronization, thus being multicore friendly.

  • Being a fully fledged alternative to stackful RTOS's with priority based scheduling, but with stackless asynchronous tasks.

Minimum supported Rust version (MSRV)

Hyperloop requires nightly for the time being, due to dependence on unstable features.

FAQ

Why async? Can't we just use plain old stackful tasks?

Async tasks have a minimal memory footprint and are a good fit for memory constrained microcontrollers. Tasks should be cheap and you should be able to another task without having to worry much about memory usage. Stackful tasks need a lot of memory for the stack, especially if you need string formatting for logging. Stackful tasks do allow for preemption, but it comes at a high price.

How does Hyperloop differ from Embassy

Embassy provides not only an executor, but a whole embedded async ecosystem. Hyperloop is much more limited in scope. The main difference between the Embassy exeutor and Hyperloop is that Hyperloop uses priority based scheduling.

hyperloop's People

Contributors

eivindbergem avatar

Stargazers

ekis avatar David M. Golembiowski avatar José Luis Cruz avatar Jeff Carpenter avatar

Watchers

 avatar

hyperloop's Issues

Add state to task to avoid queuing task more than once

Wake can be called more than once for each waker, as it can be cloned or woken used multiple times with wake_by_ref. With a fixed capacity priority queue, this can cause trouble. To remedy this, the task could have a state and only if the task is not currently waiting can it be added to the queue.

Add macro to create executor from tasks

Tasks are static, so we should be able to create an executor with size equal to the number of tasks, being able to write something like

let executor = executor_from_tasks!(task1, task2, task3);

This should return a reference to a static executor, and all tasks should be added to the task queue.

Make timer more ergonomic

The timer has a lot of parts making it clunky to use. Ideally it should be more like:

static TIMER: AtomicOnceCell<Timer> = AtomicOnceCell::new();

#[task(priority = 1)]
async fn task() {
    let timer = TIMER.get().unwrap().clone();

    loop {
         // [...]
    }
}

fn main() {
    let countdown = impl_countdown_of_choice();
    let task1 = task1_fn();
    let executor = static_executor!(countdown, task1);

    TIMER.set(executor.get_timer()).unwrap();

    // [...]
}

Add support for multicore systems

The priority queue at the moment supports producers preempting producers and the consumer, but not the consumer preempting producers. When running on a single core system, that's fine, but it will not work on multi core systems. Supporting this means re-writing the stack part of the priority queue to look more like ArrayQueue from crossbeam.

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.