Concurrency in Rust

Instructor: Martin Geisler

As modern CPUs get more and more cores, the ability to make efficient use of them becomes more and more important. Rust is uniquely suited to do this because of how its borrow checker prevents a wide range of problems in concurrent programs. This feature of Rust is often called fearless concurrency.

This workshop will show you how Rust enables you to do safe concurrent programming. We will talk about thread-based concurrency as well as the async/await style concurrency.

The Concurrency in Rust material is taken from the freely available Comprehensive Rust family of Rust courses.

Target Audience

This is an advanced class which assumes that you are already familiar with basic Rust. Concepts like borrowing, generics, and closures should be familiar to you. If you work through the material for Rust Fundamentals, then you will be up to speed.

Prerequisites

The workshop assumes that you have a functioning Rust setup with your favorite editor configured for Rust development. To prepare for the workshop, please also go through the following steps:

  1. Create a fresh project: cargo init concurrency.
  2. Add Tokio as a dependency: cargo add tokio --features full
  3. Compile the code at least once: cargo run

This will save you some time since there are many dependencies to download and compile.

You can then copy/paste the examples into src/main.rs to experiment with them during the workshop.

Topics

The workshop is split in two parts: thread-based and async/await-based concurrency.

Morning: Multi-threaded Rust

In the morning, we will cover how to use threads in Rust:

The morning session will take approximately 3 hours.

Afternoon: Async Rust

In the afternoon, we will cover concurrency with async Rust:

The afternoon session will take approximately 3 hours.

The workshop can fit 16 people.


Martin Geisler

For location and schedule visit our Workshops page