/my-async-rs

An example async runtime.

Primary LanguageRustMIT LicenseMIT

my-async-rs

An example asynchronous runtime in Rust.

This project is primarily served as the codebase of my Graduation Project, Analysis and Research on Rust's Asynchronous I/O Runtime Approach, advised by Prof. Chun-Ying Huang at National Yang Ming Chiao Tung University for my BSc degree in Computer Science during March 2022 to January 2023.

Purpose

The purpose of this project is to serve as an easy source for people to understand what an implementation of a async runtime in Rust could look like before looking at much more complex codebases like those of tokio and async-std. The project also provides a design document to demonstrate my design approach on details, which can be found at the end at the [Documents] section.

Overview

  • The code contains a single-threaded runtime and a multi-threaded runtime with 3 different work scheduler implementations.
  • The multi-threaded runtime uses message passing to control the underlying scheduler and mio as the reactor to receive IO events from the OS.
  • The scheduler of the multi-threaded runtime is defined as a trait to be able to contain multiple implementation. Currently, round-robin, work stealing, and a hybrid strategy that combines work stealing and priority queue are implemented.

Documents

Design Documents can be found at Here.

Credits

  • tokio: Used code in concurrent-ringbuf for a static-size work-stealing ring buffer as well as various design concepts in this project. License: MIT
  • Prof. Chun-Ying Huang: For evaluating various design approach and mentoring during the project period.