Lably
Skip to content

Tokio (software)

  • 3 min read
  • 2 chapters

Related on Lably

Through Library (computing), Java virtual machine and JavaScript

Tokio was released in August 2016 for Rust, a general-purpose programming language. Developed by Carl Lerche, Tokio began as a network application framework and supports features such as socket listening and broadcasting, allowing messages to be transferred between computers.

History

Tokio began in August 2016 by Carl Lerche as a network application framework for Rust built on futures, allowing for network-based middleware and a non-blocking, or asynchronous, implementation of readiness interest to the reactor. Tokio was inspired by Finagle, a Scala-based asynchronous remote procedure call (RPC) system developed at Twitter for Java virtual machines (JVM), allowing distributed systems to communicate within a JVM. Tokio utilizes the lower-level Rust crate mio, itself using system calls such as epoll (Linux), kqueue (FreeBSD), and the input/output completion port (IOCP) API (Windows). For Linux it can also use io_uring via tokio-uring. The name "Tokio" is derived from Tokyo and mio. The preliminary version of Tokio was released in January 2017, followed by a full release in December 2020. In 2017, Tokio received a grant from the Mozilla Open Source Support fund. In April 2021, Tokio funded its first paid contributor, Alice Ryhl, for her work both developing the project and assisting its users.

While Rust has supported asynchronous functions since version 1.39, released in November 2019, it provides no facilities to execute them, requiring an external runtime for that purpose. Tokio provides a runtime that uses a multi-threaded work stealing scheduler. Rust's futures are lazily evaluated, requiring functions to call .await before they do any work. When .await is invoked, Tokio's runtime may pause the original future until its I/O completes, and unpauses a different task that is ready for further processing.

Users of Tokio include the development teams behind Discord and AWS Lambda. The JavaScript and TypeScript runtime Deno uses Tokio under the hood, in comparison to the JavaScript runtime Node.js, which uses the libuv library.

Sign in to keep reading

One more chapter is free with a Lably account.

More in Computing and communication