欢迎了解 Rust 中的并发
Rust 完全支持使用带有互斥锁和通道的操作系统线程进行并发。
Rust 类型系统能帮助我们把许多并发bug转换为编译期bug 发挥着重要作用。这通常称为“无畏并发”,因为你可以依靠编译器来确保 运行时的正确性。
时间表
Including 10 minute breaks, this session should take about 3 hours and 20 minutes. It contains:
Segment | Duration |
---|---|
线程 | 30 minutes |
通道 | 20 minutes |
Send 和 Sync | 15 minutes |
共享状态 | 30 minutes |
习题 | 1 hour and 10 minutes |
- Rust lets us access OS concurrency toolkit: threads, sync. primitives, etc.
- The type system gives us safety for concurrency without any special features.
- The same tools that help with “concurrent” access in a single thread (e.g., a called function that might mutate an argument or save references to it to read later) save us from multi-threading issues.