O'Reilly logo

Mastering Rust by Vesa Kaihlavirta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Concurrency

Often, we'd like our programs to do several things at the same time:

  • The user interface of a program continues working normally even though our program connects to the network
  • A game updates the state of thousands of units at the same time, while playing a soundtrack in the background
  • A scientific program splits computation in order to take full advantage of all the cores in the machine
  • A web server handles more than one request at a time in order to maximize throughput

Rust has a safe form of concurrency, backed by the memory model system described in the previous chapter. In this chapter, we will go through how multithreading, sharing state, and message passing work in Rust.

The topics covered in this chapter are as follows: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required