The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
Engineering Zero-Allocation Async Runtimes with std::execution and Structured Concurrency
Coroutines look synchronous, and that is exactly why they fail in production. This book builds a complete async runtime in modern C++: tasks, schedulers, frame allocators, structured concurrency, cancellation, and a bridge to C++26 std::execution. Every chapter starts with a real failure and ends with a measured cost, down to a tested zero allocations per request.
Minimum price
$29.00
$39.00
About the Book
Your coroutines pass every test. Then production load makes the I/O genuinely asynchronous.
A const std::string& parameter dangles. A stack overflows only when the cache is warm. A lost wakeup stalls a pool for fifty milliseconds. A fire-and-forget coroutine crashes the service at shutdown, once every twenty deploys. None of these are compile errors, and none show up in a thread dump, because a suspended coroutine is not on any stack.
This book is about those failures: why they happen, how to reproduce them on demand, and how to build a runtime where they cannot.
What you will build
Over fourteen chapters you build one runtime, piece by piece, and every piece is tested under AddressSanitizer and ThreadSanitizer:
sync_wait, a single-threaded run loop, a thread pool, and a work-stealing scheduler, with the sleep protocol that avoids lost wakeupswhen_all, when_any, async scopes, and fail-fast error propagation that make fire-and-forget impossiblestd::stop_token, deadlines, race-free cancellation, and shielded async cleanupstd::execution, with a phased migration plan for an existing runtimeWhat makes it different
Inside the book
std::generator, ranges composition, elements_of, and where a hand-written iterator still winswhen_all, cancellation, timeouts, lifetimes across suspensionstd::execution: senders and receivers, custom senders, coroutines and senders in both directions, migrationstd::execution algorithm reference, compiler and library support matrix, and a coroutine code review checkliststd::executionYou should be comfortable with templates, move semantics, RAII, the memory model, and threads. This is not an introduction to what coroutines are.
What you will be able to dostdexec, and the standard task, and migrate between them in safe phasesGCC 13+, Clang 17+, or Visual Studio 2022; CMake 3.25+; NVIDIA stdexec for Part V onward. Linux is recommended for ThreadSanitizer and perf.
Bundles that include this book
About the Author
Weston Ashgrove is a C++ systems engineer who builds software where being wrong or slow has a cost. He came up through quantitative trading, building order books, matching logic and the low-latency infrastructure underneath them and now brings the same discipline to performance engineering, concurrency, storage, networking, GPUs, and AI inference.
His rule for performance-critical code is simple: nothing is true until it has been profiled, fuzzed, and replayed. Every technique in his books comes with the measurement that proves it, the trade-off it costs, and the failure it prevents. He writes for working engineers who ship and debug production C++, and he leaves out anything that only works on a slide.
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
Learn more about writing on Leanpub
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them
You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!
Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.
Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.