CppCon 2016: Nat Goodspeed “Elegant Asynchronous Code'

preview_player
Показать описание


Asynchronous I/O is an essential technology for increasing concurrency without introducing more threads, which carry both overhead and risks. Unfortunately, leveraging async I/O can be disruptive to careful code architecture.

This talk focuses not on the mechanics of async I/O, but rather on a library that manages async I/O with code that looks and behaves like traditional sequential code. Boost.Fiber introduces "userland threads," permitting the application coder the benefits of both async I/O and clean layers of abstraction.

This talk presents an overview of the library, discusses integration with event-driven frameworks and illustrates several useful patterns.


Nat Goodspeed
Linden Lab
Nat Goodspeed first read about C++ shortly after implementing a medium-sized language interpreter in classic C. Almost every C++ feature led to forehead smacking accompanied by muttered remarks about how the language could have solved THIS problem... He has been fascinated (sometimes infuriated) by C++ ever since.

When he first encountered Boost libraries, a light shone from the heavens and choirs of angels sang "AAAAAAH..." The idea of writing and maintaining C++ code without Boost has become unthinkable -- even now that some of those libraries have been adopted into the C++ standard.

Nat has presented papers on coroutines and fibers to WG21, the ISO C++ committee. He has spoken on these topics at C++ Now conferences.

Nat has worked on databases, games and virtual worlds, usually on architecture and infrastructure. He has functioned as Boost evangelist within various organizations.


*-----*
*-----*
Рекомендации по теме
Комментарии
Автор

5 years late to watching this video but my God has this actually helped me understand the usefulness of the newly added coroutines with async functions.

XxxGuitarMadnessxxX
Автор

To me, this is a very good presentation of why we need fiber. Try to use boost asio, boost coroutine before watching this video.

ZiyangJiangSheep
Автор

24:00 You can manage stacksize and set stacks entirely in pthreads as well.

nullplan
Автор

I still feel like vc++'s resumable functions are easier to reason about, but this did show me that perhaps fibers still have some room to innovate.

DonPhrostByte
Автор

I must have missed something: what is the advantage of using fibers instead of threads?

SlowCarToChina
Автор

Good talk, but skimmed though the examples a bit too fast. It is also kind of confusing to me,  that all examples are ultimately blocking to the caller, or I am missing something?

YourCRTube
Автор

Introduction was a bit lengthy, but apart from that - nice talk ! Thank You!

PaweSkalczynski
Автор

20 minutes in only to find boost lib is part of the solution.

sdmarlow
Автор

I think fibers are the closest you can get to python asyncio in c++.

mwont
Автор

I still don't understand how to accomplish "elegant asynchronous code". Maybe I'm trying too much to fit this to my own use case that doesn't make sense? I'm thinking of a networking library that I use in which I register callbacks that are called when certain network traffic is encountered. This callback stuff is making my code look like spaghetti. Perhaps this fiber-based approach to asynchronous code isn't helpful in my case because the library wasn't written that way. It creates a new thread on a connection and calls my callbacks through that thread, so I think I'll need to go the message queue route.

I'm still happy I watched the talk: I learned a bunch about boost fibers!

dartme
Автор

Could you get rid of the line by line presentation, next time? That would improve the presentation style.

towitorstenwill