Skip to content
0:00 / 0:00

#coroutines#jvm#cps

KotlinConf 2017 - Deep Dive into Coroutines on JVM by Roman Elizarov

JetBrains

236K subscribers • 29 videos on Hallway

YouTube
  • Recommended by 7 people: 7 in engineering communities.
  • A classic. People kept recommending it from 2018 to 2024.
  • Presented by Roman Elizarov, coroutines project lead
  • Made by the vendor. The company whose product it covers made or sponsored it.

Advanced. Deep dive for people who know the field.

95K views8 years ago7 recommendations

Programming languagesSystems programmingKotlinConcurrency and parallelismLanguage design and type systems

Roman Elizarov explains the design, JVM implementation, and bytecode generation of Kotlin coroutines.

In this talk, we perform a deep dive into the design and implementation of Kotlin coroutines for those who like to understand it down to the bottom. What were the design goals of the Kotlin coroutines and how are they implemented on JVM? What is the difference between CPS and CSP? What concept stands behind the suspending functions in Kotlin and how are they represented on JVM? What exactly happens when you launch coroutines and how much actual overhead do they have? Can you use Kotlin coroutines from Java? This talk answers these and other coroutine-related questions, showing and explaining the corresponding byte code that is produced by the Kotlin compiler with code samples and benchmarks. Roman Elizarov is a professional software developer with more than 16 years experience. He started his career at Devexperts, where he designed and developed high-performance trading software for leading brokerage firms and market data delivery services that routinely handle millions of events per second. He is an expert in Java and JVM, particularly in real-time data processing, algorithms and performance optimizations for modern architectures. Roman currently works on the Kotlin language at JetBrains. Having worked on very large systems comprising of many modules written in different languages, he has a dream of a single language that can be used to write all parts of a very large distributed system, to share and reuse data models and algorithms without friction. Kotlin with JVM and JS backends and the upcoming native compiler is the ideal candidate to realize this dream. In 2000 Roman had graduated from St. Petersburg ITMO. He now teaches a course on concurrent and distributed programming in ITMO. During his undergraduate study, he participated at ACM International Collegiate Programming Contest (ICPC). Since 1997 and until now Roman serves as a Chief Judge of Northeastern European Regional Programming Contest (NEERC) of ACM ICPC.

Why it's here

7 people recommend this

What people say. Highly recommended as an essential deep dive into how Kotlin coroutines work under the hood.

u/O1ivePizzain r/Kotlin • Recommends

On “Is it a good idea that I'm trying to learn multithreading in Java before I can fully grasp how Coroutine works in Kotlin?”

I'd say learn what threads are on an OS level, learn how to use them in kotlin, learn about threads in Android and lastly learn how coroutines work. This is a great talk about coroutines in debth: link to this video

u/Matthiskin r/Kotlin • Recommends

On “Kotlin Under the Hood: Understand the Internals (Google I/O'19)”

Really interesting talk. In the last few slides they touch on the internals of coroutines, unfortunately they can't go in depth on this topic. If you are interested in this topic I can highly recommend this talk: link to this video by Roman.

u/DoListeningin r/Kotlin • Recommends

On “Explore How Kotlin Coroutine Works Under The Hood”

This 2017 talk explains it a lot better (warning: loud intro).

u/i_dont_know_him_manin r/Kotlin • Recommends

On “Resources on coroutines”

In my opinion the content of Roman Elizarov (ex-project lead on Kotlin) is pure gold in understanding these concepts at a deeper level. I don't know if this is a style that fits all (probably not) but from my experience and from some chats with colleagues I figured this is some good material that works with a relative large audience. I gathered some resources here for you, but in case you find the time I would recommend browsing through his medium protfolio or his conference talks. # Coroutines * Kotlin Coroutines, a deeper look * Coroutine Context and Scope * The reason to avoid GlobalScope # Flows & Channels: * Shared flows, broadcast channels * Cold flows, hot channels Now in ca…

u/spork_kingin r/Kotlin • Recommends

On “Best resources on kotlin coroutines?”

I use the coroutines guide quite a bit and find that really helpful. Roman Elizarov (coroutines project lead) gave two talks at KotlinConf 2017 on coroutines. Spend 2 hours to watch these and you'll have a better understanding of what they do and how they work under the covers. I thought I understood them before attending these sessions, and I really learned a lot. Totally changed my understanding. * Part 1: Introduction to Coroutines. * Part 2: Deep Dives into Coroutines on JVM. The #coroutines channel on Kotlin Slack is active and helpful. Project members and heavy users hang out there and provide useful advice when asked.

u/O1ivePizzain r/Kotlin • Recommends

On “is coroutine suitable for background services?”

There is a nice talk on YouTube on how coroutines work internally. link to this video Basically, coroutines are implement using a pool of threads, so it shouldn't make a differnce for your use-case.

u/withoutclassin r/Kotlin • Recommends

On “Explicit concurrency – Roman Elizarov”

It signals that this function may suspend it's execution at some point. If you're interested in how it likely works I'd suggest watching the coroutines deep dive. My hunch is that the suspend keyword enables compiler magic to support suspension/resumption.

u/hackometerin r/Kotlin • Recommends

On “Looking for a good resources to learn about kotlin concurrency model and coroutines”

For deep understanding I can recommend the talk Deep Dive into Coroutines on JVM Roman Elizarov gave in 2017. Also this post on Stack Overflow could help you understand the fundamentals.

u/koreyeczin r/Kotlin • Mentions

On “Hey #Kotliners💡, ever wondered how #Coroutines work under the hood?🤔 Cool! This November, Mohit Sarveiya (Android GDE) will dissect 🗡️ coroutines and take us through some of the lesser known and advanced features of #Kotlin coroutines! RSVP”

The Kotlin Coroutines creator [video

u/Wurstinatorin r/Kotlin • Mentions

On “understand coroutines-implementation in kotlin-compiler”

Coroutines are not compiled to Threads btw https://en.wikipedia.org/wiki/Continuation-passing\_style [video