Submit Search
Upload
Concurrency in Kotlin with coroutines
•
1 like
•
66 views
Jörn Dinkla
Follow
Slides of talk from April 2019 about coroutines in Kotlin.
Read less
Read more
Software
Report
Share
Report
Share
1 of 84
Download now
Download to read offline
Recommended
Weekly Documentation
Weekly Documentation
Sohel Sarker
A short introduction to Kotlin
A short introduction to Kotlin
Jörn Dinkla
3D Games Rendering - Érico de Morais Nunes
3D Games Rendering - Érico de Morais Nunes
Tchelinux
Dfrws eu 2014 rekall workshop
Dfrws eu 2014 rekall workshop
Tamas K Lengyel
2014 03-25 - GDG Nantes - Web Components avec Polymer
2014 03-25 - GDG Nantes - Web Components avec Polymer
Horacio Gonzalez
Blender presentation at SIGGRAPH 2013
Blender presentation at SIGGRAPH 2013
prokoudine
Eudyptula Challenge
Eudyptula Challenge
Drew Fustini
The Chromium/Wayland Project (Lightning Talk) (BlinkOn 9)
The Chromium/Wayland Project (Lightning Talk) (BlinkOn 9)
Igalia
Recommended
Weekly Documentation
Weekly Documentation
Sohel Sarker
A short introduction to Kotlin
A short introduction to Kotlin
Jörn Dinkla
3D Games Rendering - Érico de Morais Nunes
3D Games Rendering - Érico de Morais Nunes
Tchelinux
Dfrws eu 2014 rekall workshop
Dfrws eu 2014 rekall workshop
Tamas K Lengyel
2014 03-25 - GDG Nantes - Web Components avec Polymer
2014 03-25 - GDG Nantes - Web Components avec Polymer
Horacio Gonzalez
Blender presentation at SIGGRAPH 2013
Blender presentation at SIGGRAPH 2013
prokoudine
Eudyptula Challenge
Eudyptula Challenge
Drew Fustini
The Chromium/Wayland Project (Lightning Talk) (BlinkOn 9)
The Chromium/Wayland Project (Lightning Talk) (BlinkOn 9)
Igalia
Presentation of the book "Mikado Method"
Presentation of the book "Mikado Method"
Jörn Dinkla
Korrekte nebenläufige Anwendungen mit Koroutinen und TDD
Korrekte nebenläufige Anwendungen mit Koroutinen und TDD
Jörn Dinkla
Nebenlaeufigkeit mit Koroutinen strukturieren
Nebenlaeufigkeit mit Koroutinen strukturieren
Jörn Dinkla
Plain react, hooks and/or Redux ?
Plain react, hooks and/or Redux ?
Jörn Dinkla
Nebenläufigkeit mit Kotlins Koroutinen
Nebenläufigkeit mit Kotlins Koroutinen
Jörn Dinkla
GPU-Computing mit CUDA und OpenCL
GPU-Computing mit CUDA und OpenCL
Jörn Dinkla
Schulung: Einführung in das GPU-Computing mit NVIDIA CUDA
Schulung: Einführung in das GPU-Computing mit NVIDIA CUDA
Jörn Dinkla
Die ‚komplexe‘ Perspektive - Einführung in die digitale Wirtschaft
Die ‚komplexe‘ Perspektive - Einführung in die digitale Wirtschaft
Jörn Dinkla
Geschäftsmodelle -Ein kurzer Überblick
Geschäftsmodelle -Ein kurzer Überblick
Jörn Dinkla
Buchvorstellung "Libertarian Anarchy: Against the State" von Gerard Casey
Buchvorstellung "Libertarian Anarchy: Against the State" von Gerard Casey
Jörn Dinkla
Multi-GPU-Computing: Eins, zwei, drei, ganz viele
Multi-GPU-Computing: Eins, zwei, drei, ganz viele
Jörn Dinkla
Tipps & Tricks für den erfolgreichen Einsatz von GPU-Computing
Tipps & Tricks für den erfolgreichen Einsatz von GPU-Computing
Jörn Dinkla
GPU-Computing mit CUDA und OpenCL in der Praxis
GPU-Computing mit CUDA und OpenCL in der Praxis
Jörn Dinkla
Introduction To Parallel Computing
Introduction To Parallel Computing
Jörn Dinkla
Subversion Schulung
Subversion Schulung
Jörn Dinkla
Test-Driven-Development mit JUnit 4
Test-Driven-Development mit JUnit 4
Jörn Dinkla
Ant im Detail
Ant im Detail
Jörn Dinkla
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
umasea
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
soniya singh
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
Andreas Granig
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
OPEN KNOWLEDGE GmbH
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
MyIntelliSource, Inc.
More Related Content
More from Jörn Dinkla
Presentation of the book "Mikado Method"
Presentation of the book "Mikado Method"
Jörn Dinkla
Korrekte nebenläufige Anwendungen mit Koroutinen und TDD
Korrekte nebenläufige Anwendungen mit Koroutinen und TDD
Jörn Dinkla
Nebenlaeufigkeit mit Koroutinen strukturieren
Nebenlaeufigkeit mit Koroutinen strukturieren
Jörn Dinkla
Plain react, hooks and/or Redux ?
Plain react, hooks and/or Redux ?
Jörn Dinkla
Nebenläufigkeit mit Kotlins Koroutinen
Nebenläufigkeit mit Kotlins Koroutinen
Jörn Dinkla
GPU-Computing mit CUDA und OpenCL
GPU-Computing mit CUDA und OpenCL
Jörn Dinkla
Schulung: Einführung in das GPU-Computing mit NVIDIA CUDA
Schulung: Einführung in das GPU-Computing mit NVIDIA CUDA
Jörn Dinkla
Die ‚komplexe‘ Perspektive - Einführung in die digitale Wirtschaft
Die ‚komplexe‘ Perspektive - Einführung in die digitale Wirtschaft
Jörn Dinkla
Geschäftsmodelle -Ein kurzer Überblick
Geschäftsmodelle -Ein kurzer Überblick
Jörn Dinkla
Buchvorstellung "Libertarian Anarchy: Against the State" von Gerard Casey
Buchvorstellung "Libertarian Anarchy: Against the State" von Gerard Casey
Jörn Dinkla
Multi-GPU-Computing: Eins, zwei, drei, ganz viele
Multi-GPU-Computing: Eins, zwei, drei, ganz viele
Jörn Dinkla
Tipps & Tricks für den erfolgreichen Einsatz von GPU-Computing
Tipps & Tricks für den erfolgreichen Einsatz von GPU-Computing
Jörn Dinkla
GPU-Computing mit CUDA und OpenCL in der Praxis
GPU-Computing mit CUDA und OpenCL in der Praxis
Jörn Dinkla
Introduction To Parallel Computing
Introduction To Parallel Computing
Jörn Dinkla
Subversion Schulung
Subversion Schulung
Jörn Dinkla
Test-Driven-Development mit JUnit 4
Test-Driven-Development mit JUnit 4
Jörn Dinkla
Ant im Detail
Ant im Detail
Jörn Dinkla
More from Jörn Dinkla
(17)
Presentation of the book "Mikado Method"
Presentation of the book "Mikado Method"
Korrekte nebenläufige Anwendungen mit Koroutinen und TDD
Korrekte nebenläufige Anwendungen mit Koroutinen und TDD
Nebenlaeufigkeit mit Koroutinen strukturieren
Nebenlaeufigkeit mit Koroutinen strukturieren
Plain react, hooks and/or Redux ?
Plain react, hooks and/or Redux ?
Nebenläufigkeit mit Kotlins Koroutinen
Nebenläufigkeit mit Kotlins Koroutinen
GPU-Computing mit CUDA und OpenCL
GPU-Computing mit CUDA und OpenCL
Schulung: Einführung in das GPU-Computing mit NVIDIA CUDA
Schulung: Einführung in das GPU-Computing mit NVIDIA CUDA
Die ‚komplexe‘ Perspektive - Einführung in die digitale Wirtschaft
Die ‚komplexe‘ Perspektive - Einführung in die digitale Wirtschaft
Geschäftsmodelle -Ein kurzer Überblick
Geschäftsmodelle -Ein kurzer Überblick
Buchvorstellung "Libertarian Anarchy: Against the State" von Gerard Casey
Buchvorstellung "Libertarian Anarchy: Against the State" von Gerard Casey
Multi-GPU-Computing: Eins, zwei, drei, ganz viele
Multi-GPU-Computing: Eins, zwei, drei, ganz viele
Tipps & Tricks für den erfolgreichen Einsatz von GPU-Computing
Tipps & Tricks für den erfolgreichen Einsatz von GPU-Computing
GPU-Computing mit CUDA und OpenCL in der Praxis
GPU-Computing mit CUDA und OpenCL in der Praxis
Introduction To Parallel Computing
Introduction To Parallel Computing
Subversion Schulung
Subversion Schulung
Test-Driven-Development mit JUnit 4
Test-Driven-Development mit JUnit 4
Ant im Detail
Ant im Detail
Recently uploaded
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
umasea
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
soniya singh
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
Andreas Granig
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
OPEN KNOWLEDGE GmbH
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
MyIntelliSource, Inc.
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
AxelRicardoTrocheRiq
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
soniya singh
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
Christina Lin
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
kaushalgiri8080
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Christina Lin
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
kalichargn70th171
Professional Resume Template for Software Developers
Professional Resume Template for Software Developers
Vinodh Ram
EY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
Neo4j
Asset Management Software - Infographic
Asset Management Software - Infographic
Hr365.us smith
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
VICTOR MAESTRE RAMIREZ
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
Dinusha Kumarasiri
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
MyIntelliSource, Inc.
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
Wave PLM
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
OnePlan Solutions
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Delhi Whatsup 9873940964 Enjoy Unlimited Pleasure
Recently uploaded
(20)
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
Professional Resume Template for Software Developers
Professional Resume Template for Software Developers
EY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
Asset Management Software - Infographic
Asset Management Software - Infographic
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Concurrency in Kotlin with coroutines
1.
Concurrency in Kotlin with
coroutines Jörn Dinkla (translated and extended edition of slides for a talk at para//el 2019)
2.
3.
● ● ○ ● ○ ○
4.
● ○ ○ ● ○ ○ ○
5.
● ○ ○ ● ○ ○ ●
6.
● ● Feedback link in
the chat!
7.
1985 1998 2004 2007
20192001 2010 2013 2016 Reactive 2017 Fork/Join 2011 Streams CmplFut 201420041995 thread 2011 mutex 2014 par STL 2017 1.0 2016 1.3 2018
8.
“A community of
passionate individuals whose purpose is to revolutionize software design, creation and delivery, while advocating for positive social change.” We are hiring ...
9.
© https://www.flickr.com/photos/dougtone/
10.
● ● ○ ● ○ ● ●
11.
● ● ● ● ○ ○ ○
12.
● ● ● ○
13.
!
14.
● ○ ● ● ○ ■ ○
15.
16.
17.
● ● ○ ○ $ find .
-name "*.kt" | xargs wc -l
18.
● ● ○ ● ○ ○ ●
19.
● ● Thread ● ● ○ ● ○
20.
21.
Java11 HttpClient
22.
● ○ ○ ● ○ java.util.concurrent.Executors ○ ●
23.
Kotlin as better Java
!
24.
Why so low?
25.
server [main thread] Handler
[thread] Handler [thread] Start End Web Web Waiting WaitingSleeping Sleeping
26.
27.
W C Ncpu Ucpu
W C Nthreads 8 1.0 0 1 8 8 1.0 1 1 16 8 1.0 1 2 12 8 1.0 2 1 24 CPU bound
28.
● ○ ○ ● ○ ○
29.
30.
● ○ ○ ● ○ ○
31.
● ○ ○ ○
32.
● ● ● ● ●
33.
● ○ ● Future ● CompletableFuture ●
34.
We are still using threads
and pools!
35.
Chaining
36.
● ○ ● ○ ○
37.
● ● ○ ○ ○ ○ ●
38.
39.
40.
● ○ ● ○ ○
41.
42.
String!
43.
Looks like a build
in function
44.
Internal DSL
45.
● ● ●
46.
starts CoroutineScope and waits
for all coroutines Starts Coroutine async like Thread.sleep()
47.
runBlocking {...} suspend
48.
suspend ● ● Suspendable function
or lambda ○ ●
49.
suspend Refactor > Extract
> Function Ctrl+Alt+M
50.
CoroutineScope Refactor > Extract
> Function Ctrl+Alt+M
51.
CoroutineScope ● ○ ● ○ Job ● ○ ○ SupervisorJob() ■
52.
launch ● launch Job ● ● Like
a thread?
53.
async ● async Deferred<T> Like
a future?
54.
● ○ ● ○
55.
Continuation 1991
56.
Kotlin Evolution and
Enhancement Process
57.
state resume Simplification
58.
CoroutineContext ● ○ isActive() ● ○ Job
Deferred ●
59.
CoroutineContext
60.
CoroutineDispatcher ● Dispatchers.Default ○ ● Dispatchers.IO ○
kotlinx.coroutines.io.parallelism ● Dispatchers.Main ○
61.
● ● ● CoroutineDispatcher ● ○
62.
63.
64.
65.
● ○ ● ○ ●
66.
67.
● Channel(capacity) ○ capacity
0 ■ ○ capacity unlimited ■ ○ capacity ■ ○ capacity conflated
68.
69.
● ● ● ● ● ●
70.
Kotlin’s OO model
71.
Caveat: experimental, obsolete, But newer
version not available
72.
73.
● ● ● ●
74.
Code is straightforward again!
75.
76.
77.
● ● ○ ● ● ○
78.
● ○ ● ○ ● ○ ●
79.
● ● ●
80.
81.
● ● ●
82.
● ○ ○ ○ ● ○ ○
Download now