SlideShare a Scribd company logo
{ Kotlin }
Statically typed language for the JVM,
Android and the browser.
Developed by JetBrains
{ Little about the language }
● Null safety
● Expressive
● 100% java interoperability
-------------------------------------------------
● Lambdas
● ( map, filter, reduce ..)
● Higher-order functions
● Extensions
● Automatic type inference
● Inline functions
● …..
{ Coroutines }
● NOT A THREAD !!!
Is like
● Lightweight threads
● More like daemon threads
● Programs that allows to run multiple program cooperatively
Behind the scene
ExecutorService
ThreadPoolExecutor
Executors
Thread pools
….
+ Kotlin implementation of pools, CoroutineDispatcher and etc
● Write asynchronous code as it was synchronous
● Avoid from callback hell
● Run multiple async computations simultaneously(demo in example)
● Less memory usage (compared to Threads)
{ Coroutines }
{ Coroutines VS Threads }
Coroutine -
● It is stackless(doesn't have own stack) low memory usage
● Doesn't map on native thread
● Managed by user
● Cooperatively multitasking (no context switch)
● Launch
● Async
● Future
● Deferred
● suspend
● await
{ Coroutines }
{ Coroutines }
1 start coroutine
2 var rawData = startSomeNetworkRequest.await()
3 var data = parseData(rawData).await()
4 diplayData(data)
Create 100 000 coroutine which runs simultaneously
val jobs = List(100_100) {
async(CommonPool) {
delay(1000)
1
}
}
jobs.sumBy{ it.await() }
{ Coroutines }.example

More Related Content

What's hot (20)

PDF
From C++ to JS via Emscripten
TomNickson
 
PDF
ZeroMQ with NodeJS
Fernando Sanabria
 
PDF
Clojure presentation
Karthik Raghunahtan
 
PPT
Leveraging zeromq for node.js
Ruben Tan
 
PPTX
C++ on the Web: Run your big 3D game in the browser
Andre Weissflog
 
PPTX
Data Management and Streaming Strategies in Drakensang Online
Andre Weissflog
 
PPTX
Asynchronous Programming in .NET
Pierre-Luc Maheu
 
KEY
Distributed app development with nodejs and zeromq
Ruben Tan
 
PDF
Making CLI app in ruby
Huy Do
 
PDF
Docker at Cloud9 IDE
lennartkats
 
PDF
From rest api to graph ql a 10 year journey
Arno Schulz
 
PDF
Introduction to ZeroMQ - eSpace TechTalk
Mahmoud Said
 
PDF
Gabriele Santomaggio - Inside Elixir/Erlang - Codemotion Milan 2018
Codemotion
 
KEY
CPAN Gems From The Far East
lestrrat
 
ODP
Rust Primer
Knoldus Inc.
 
PPT
Programming
fika sweety
 
PDF
Java introduction with JVM architecture
atozknowledge .com
 
PPTX
Evented Ruby VS Node.js
Nitin Gupta
 
PPTX
Introduce native client
Young-Ho Cha
 
From C++ to JS via Emscripten
TomNickson
 
ZeroMQ with NodeJS
Fernando Sanabria
 
Clojure presentation
Karthik Raghunahtan
 
Leveraging zeromq for node.js
Ruben Tan
 
C++ on the Web: Run your big 3D game in the browser
Andre Weissflog
 
Data Management and Streaming Strategies in Drakensang Online
Andre Weissflog
 
Asynchronous Programming in .NET
Pierre-Luc Maheu
 
Distributed app development with nodejs and zeromq
Ruben Tan
 
Making CLI app in ruby
Huy Do
 
Docker at Cloud9 IDE
lennartkats
 
From rest api to graph ql a 10 year journey
Arno Schulz
 
Introduction to ZeroMQ - eSpace TechTalk
Mahmoud Said
 
Gabriele Santomaggio - Inside Elixir/Erlang - Codemotion Milan 2018
Codemotion
 
CPAN Gems From The Far East
lestrrat
 
Rust Primer
Knoldus Inc.
 
Programming
fika sweety
 
Java introduction with JVM architecture
atozknowledge .com
 
Evented Ruby VS Node.js
Nitin Gupta
 
Introduce native client
Young-Ho Cha
 

Similar to Coroutines in Kotlin (20)

PDF
Kotlin Coroutines and Android sitting in a tree
Kai Koenig
 
PDF
Kotlin Coroutines and Android sitting in a tree - 2018 version
Kai Koenig
 
PPTX
Coroutines in Kotlin
Alexey Soshin
 
PPTX
Kotlin coroutines and spring framework
Sunghyouk Bae
 
PPTX
Exploring Kotlin
Atiq Ur Rehman
 
PPTX
Fall in love with Kotlin
Hari Vignesh Jayapalan
 
PDF
Quick Introduction to Kotlin Coroutine for Android Dev
Shuhei Shogen
 
PDF
Asynchronous Programming in Kotlin with Coroutines
Tobias Schürg
 
PPTX
A Journey From Callback Hell To Kotlin Coroutines
Ahmed Nabil
 
PPTX
Kotlin Coroutines and Rx
Shaul Rosenzwieg
 
PDF
Coroutines in Kotlin
Dmytro Zaitsev
 
PPTX
2019-01-29 - Demystifying Kotlin Coroutines
Eamonn Boyle
 
PDF
Coroutines for Kotlin Multiplatform in Practise
Christian Melchior
 
PDF
DroidConEgypt-21-10-2022-Coroutines-AhmedNabil.pdf
Ahmed Nabil
 
PDF
Current State of Coroutines
Guido Pio Mariotti
 
PPTX
Could Virtual Threads cast away the usage of Kotlin Coroutines
João Esperancinha
 
PDF
Lightning talk: Kotlin
Evolve
 
PDF
KOTLIN COROUTINES - PART 1
Bartosz Kozajda
 
PPTX
Coroutines talk ppt
Shahroz Khan
 
PDF
Kotlin coroutine - the next step for RxJava developer?
Artur Latoszewski
 
Kotlin Coroutines and Android sitting in a tree
Kai Koenig
 
Kotlin Coroutines and Android sitting in a tree - 2018 version
Kai Koenig
 
Coroutines in Kotlin
Alexey Soshin
 
Kotlin coroutines and spring framework
Sunghyouk Bae
 
Exploring Kotlin
Atiq Ur Rehman
 
Fall in love with Kotlin
Hari Vignesh Jayapalan
 
Quick Introduction to Kotlin Coroutine for Android Dev
Shuhei Shogen
 
Asynchronous Programming in Kotlin with Coroutines
Tobias Schürg
 
A Journey From Callback Hell To Kotlin Coroutines
Ahmed Nabil
 
Kotlin Coroutines and Rx
Shaul Rosenzwieg
 
Coroutines in Kotlin
Dmytro Zaitsev
 
2019-01-29 - Demystifying Kotlin Coroutines
Eamonn Boyle
 
Coroutines for Kotlin Multiplatform in Practise
Christian Melchior
 
DroidConEgypt-21-10-2022-Coroutines-AhmedNabil.pdf
Ahmed Nabil
 
Current State of Coroutines
Guido Pio Mariotti
 
Could Virtual Threads cast away the usage of Kotlin Coroutines
João Esperancinha
 
Lightning talk: Kotlin
Evolve
 
KOTLIN COROUTINES - PART 1
Bartosz Kozajda
 
Coroutines talk ppt
Shahroz Khan
 
Kotlin coroutine - the next step for RxJava developer?
Artur Latoszewski
 
Ad

Recently uploaded (20)

PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Digital Circuits, important subject in CS
contactparinay1
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Ad

Coroutines in Kotlin

  • 1. { Kotlin } Statically typed language for the JVM, Android and the browser. Developed by JetBrains
  • 2. { Little about the language } ● Null safety ● Expressive ● 100% java interoperability ------------------------------------------------- ● Lambdas ● ( map, filter, reduce ..) ● Higher-order functions ● Extensions ● Automatic type inference ● Inline functions ● …..
  • 3. { Coroutines } ● NOT A THREAD !!! Is like ● Lightweight threads ● More like daemon threads ● Programs that allows to run multiple program cooperatively
  • 4. Behind the scene ExecutorService ThreadPoolExecutor Executors Thread pools …. + Kotlin implementation of pools, CoroutineDispatcher and etc ● Write asynchronous code as it was synchronous ● Avoid from callback hell ● Run multiple async computations simultaneously(demo in example) ● Less memory usage (compared to Threads) { Coroutines }
  • 5. { Coroutines VS Threads } Coroutine - ● It is stackless(doesn't have own stack) low memory usage ● Doesn't map on native thread ● Managed by user ● Cooperatively multitasking (no context switch)
  • 6. ● Launch ● Async ● Future ● Deferred ● suspend ● await { Coroutines }
  • 7. { Coroutines } 1 start coroutine 2 var rawData = startSomeNetworkRequest.await() 3 var data = parseData(rawData).await() 4 diplayData(data)
  • 8. Create 100 000 coroutine which runs simultaneously val jobs = List(100_100) { async(CommonPool) { delay(1000) 1 } } jobs.sumBy{ it.await() } { Coroutines }.example