Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Rustは厳しいが役に立つ Part2「Rustで非同期処理!!(概要)」
Search
NearMeの技術発表資料です
PRO
September 30, 2022
Programming
240
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Rustは厳しいが役に立つ Part2「Rustで非同期処理!!(概要)」
NearMeの技術発表資料です
PRO
September 30, 2022
More Decks by NearMeの技術発表資料です
See All by NearMeの技術発表資料です
AIエージェントのための 隔離された安全なインフラ設計
nearme_tech
PRO
0
24
Claude Code × git worktree で並列開発 (続き) -差分のサービスだけを併設する-
nearme_tech
PRO
1
69
Claude Code × git worktree で並列開発 — サブモジュール構成のリポジトリで成立させる —
nearme_tech
PRO
0
79
LLM + 強化学習
nearme_tech
PRO
0
37
PosthogのA/Bテスト機能の紹介
nearme_tech
PRO
1
110
AIフレンドリーなプロダクトに向けて
nearme_tech
PRO
2
71
初めてのLean言語
nearme_tech
PRO
0
110
Apache Airflow Workflow orchestration without turning cron into spaghetti
nearme_tech
PRO
2
50
実務で役立つ幾何学 ボロノイ図の基礎から グラフ・ネットワーク応用まで
nearme_tech
PRO
1
93
Other Decks in Programming
See All in Programming
Vue Fes Japan の “作る側”に関わってみて
naokihaba
0
160
気持ちぃ〜角丸 Squircle
ryu1013
0
320
[JA] Domain Modeling with Vanilla Rails: 「操作」から再考するRailsの設計論
yasaichi
3
450
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
280
R8 の設定見直しでアプリサイズ削減
andpad
0
220
Web Framework Benchmark Battle 2026, Any%
a_matsuda
2
2.5k
[2026-10-09]一枚の布で作らなくてもいい。 信頼性は「パッチワーク」で紡がれる~既存の運用と新しい可能性をつなぎ合わせてきたCREの話~
tosite
0
100
[Dev Group Paris Octobre 26] Agentforce, SIforce, Claudeforce, Slackbot… on s'y retrouve ?
nabondance
0
110
Workers Cache を知る
syumai
0
370
Domain-Driven Transformation
hschwentner
2
2.3k
[2026-09-26]空論ジェネリックプロセス~テスト資産とAIで紡ぐ、再現可能なパフォーマンスチューニングの話~
tosite
0
270
Jetpack Compose Mechanisms
skydoves
3
820
Featured
See All Featured
Git: the NoSQL Database
bkeepers
PRO
433
67k
The browser strikes back
jonoalderson
0
1.8k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3.1k
4 Signs Your Business is Dying
shpigford
187
23k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
The untapped power of vector embeddings
frankvandijk
2
1.9k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
2
360
Practical Orchestrator
shlominoach
192
12k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.6k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
460
Optimising Largest Contentful Paint
csswizardry
37
4k
Transcript
0 Rustは厳しいが役に立つ Part2「Rustで非同期処理!!(概要)」 2022-08-05 第9回NearMe技術勉強会 Kaito Asahi
1 目次 非同期とは? 非同期について軽くまとめています 非同期処理を実現する”Tokio” Tokioというcrateを用いたコードの例
2 非同期(Asynchronous)とは? MDNからの引用では... https://developer.mozilla.org/ja/docs/Glossary/Asynchronous 非同期とは、2つ以上の事象が同時に発生したり、関連する複 数の事象が互いの完了を待たずに発生したりする概念を指し ます (前のものが完了するのを待たずに複数の関連するもの が発生することもあります)。 “
” → 日本語の通り、待たないで実行することができる!
3 非同期処理(ConcurrencyとParallelism) “プロセス”は、「実行前状態」→「計算途中状態」→「終了状態」と表すことにする (ただし、ここでは”プロセス”を”OSのプロセス”そのものではなく、抽象的な概念として言及する。 実際、Rustの非同期処理の”プロセス”では一般に”グリーンスレッド”が利用される) 1. Concurrency(並行処理) → 複数の”プロセス”を「計算途中状態」にするような処理。 →
ただし、ある時間 t では1つの”プロセス”しか実行されない(シングルタスク)。 → 同じ処理をループでおこなうときは、初めに実行された物から出力されることが一般的。 https://www.oreilly.co.jp/book s/9784873119595/ 参考:
4 非同期処理(ConcurrencyとParallelism) 2. Parallelism(並列処理) → 複数の”プロセス”を「計算途中状態」にし、さらに同時に実行状態にすることができる処理。 → ゆえに、ループ処理では順不同で結果が出力されることがある。
5 Rustで非同期処理に便利なcrate 〜Tokio〜 Tokio is an asynchronous runtime for the
Rust programming language. It provides the building blocks needed for writing networking applications. https://tokio.rs/ → TokioはRustの非同期処理ランタイムの一つで、ネットワークアプリケーションの構築を助けてくれ る! “ ”
6 Rustで非同期処理に便利なcrate 〜Tokio〜 Ex) 1から10までの数字を表示する並行処理 use futures::future; async fn print_number(i:
i32) { println!("{}", i); } #[tokio::main] async fn main() { let fn_objs = (1..(10+1)).map(|i| print_number(i) ); future::join_all(fn_objs).await; } 1 2 3 4 5 6 7 8 9 10 出力
7 Rustで非同期処理に便利なcrate 〜Tokio〜 Ex) 1から10までの数字を表示する並列処理 use futures::future; async fn print_number(i:
i32) { println!("{}", i); } #[tokio::main] async fn main() { let fn_objs = (1..(10+1)).map(|i| tokio::spawn(async move { print_number(i).await }) ); future::join_all(fn_objs).await; } 5 1 4 2 3 6 7 8 9 10 出力
8 Thank you