Concurrency in Rust: From Fundamentals to High-Load Systems
300 pages
English
PDF
4.5

Concurrency in Rust: From Fundamentals to High-Load Systems

Concurrency in Rust: From Fundamentals to High-Load Systems

Author:

Year:

Summary:

The book "Concurrency in Rust" is a comprehensive guide to writing safe, efficient, and scalable parallel code in the Rust language. Unlike many other languages, where concurrency often leads to hard-to-find bugs and data races, Rust offers a unique ownership and type system that guarantees safety at compile time. This book will show you how to use these capabilities to their full potential.



What is this book about?

The book covers all key aspects of concurrent programming in Rust:

  • Thread basics: creating, managing, and synchronizing threads using std::thread.
  • Shared data and synchronization: working with Mutex, RwLock, Arc, and Atomic types for safely sharing state between threads.
  • Channels and message passing: using std::sync::mpsc and crossbeam to organize data exchange between threads without shared memory.
  • Asynchronous programming: a deep dive into the async/await model, futures, and executors.
  • Popular libraries: practical examples of working with Tokio, async-std, and Rayon for building high-performance applications.
  • Advanced topics: creating custom asynchronous drivers, working with Pin and Unpin, and fault-tolerance patterns.


Who is this book for?

The book is intended for:

  • Developers already familiar with the basics of Rust who want to move on to writing multithreaded and asynchronous applications.
  • Programmers from other languages (C++, Go, Python) looking to master Rust's safe concurrency model.
  • Engineers working on high-load systems, web servers, network applications, or real-time data processing tools.


What will you learn?

After reading this book, you will be able to:

  • Understand the difference between threads and asynchronous tasks and choose the right tool for each task.
  • Write code free from data races and deadlocks, using the guarantees of the Rust compiler.
  • Effectively use async/await to create thousands of concurrent connections without significant overhead.
  • Design architectures based on actors, channels, and thread pools.
  • Profile and optimize concurrent applications to achieve maximum performance.

Each chapter contains practical code examples that can be run and modified immediately. The book is written in a lively style and focuses on real-world problems developers face. After reading it, you will feel confident in the world of concurrent programming in Rust and will be able to build reliable, fast, and safe systems.

Recommendations