Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Stackful Coroutine-Based Asynchronous Programming in Rust - RustCon Asia 2019

Rust via YouTube

Overview

Save Big on Coursera Plus. 7,000+ courses at $160 off. Limited Time Only!
Explore stackful coroutine-based asynchronous programming in Rust through this RustCon Asia 2019 conference talk by Huang Xudong, author of the May framework. Dive into the design and implementation of stackful generators and coroutines, covering fundamental concepts, coroutine scheduling, IO systems, sync preemptive systems, and cancellation mechanisms. Compare this approach with future-based systems and learn about key features such as context detection, yield with parameters, and semantic blocking. Discover how coroutines differ from generators, understand the blocker concept in sync primitives, and gain insights into coroutine cancellation techniques.

Syllabus

STACKFUL COROUTINE IN RUST ANOTHER ASYNC STORY
STACKFUL GENERATOR KEY FEATURES • detect current context type • Bend and yield with parameters
STACKFUL COROUTINE • coroutine is a special thread (user space / light) • scheduler running on multi-thread semantic blocking is not real blocking call API without directly yield keep the same interface as std library
DIFFERENCE WITH GENERATOR • coroutine is a special penerator • stackful coroutine can yield from any point directly to scheduler - always yield a "kernel request" when resume the scheduler send back the result init with Coroutine Local Storage
SYNC PRIMITIVE SUB SYSTEM • yield blocker kernel request • save the suspending coroutines within primitive internal queue - scheduling the coroutines on normal scheduler with work stealing support Semphore/Mutex/RwLock/Condvar/SyncFlap/MPSC
THE BLOCKER all sync primitives are implemented based on blocker • the blocker could return Timeout/Canceled/Ok - the blocker support running in thread context
COROUTINE CANCELLATION • we tripper a special panic when detect cancel • the cancel panic would be caught and we have chance to mark the coroutine as cancelled • can only detect cancel when switch from/to

Taught by

Rust

Reviews

Start your review of Stackful Coroutine-Based Asynchronous Programming in Rust - RustCon Asia 2019

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.