Rustでの並行性へようこそ
Rustはミューテックスとチャネルを用いてOSスレッドを扱う並行性を十分にサポートしています。
Rustの型システムは多くの並行性にまつわるバグをコンパイル時のバグにとどめるという点で、重要な役割を果たします。これは時に fearless concurrency (「怖くない並行性」) と呼ばれます。なぜなら、コンパイラに実行時での正しさを保証することをまかせてよいためです。
スケジュール
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.