From Functions to CoroutinesFrom Functions to Coroutines 40 Years Evolution Rainer Grimm Training, Coaching, and Technology Consulting www.ModernesCpp.netEvolution of Callable templateT invoke(Func 0 码力 | 29 页 | 510.47 KB | 6 月前3
Deciphering C++ Coroutines2/55 Deciphering Coroutines - Part 2 Mastering Asynchronous Control Flow Andreas Weis CppCon 20243/55 About me - Andreas Weis (he/him) ComicSansMS cpp@andreas-weis.net Co-organizer of the Munich best-practice talk.16/55 A mental model for coroutines: Cooperative Threads void spawn_task () { // ... Result r = outer_function (); }16/55 A mental model for coroutines: Cooperative Threads void spawn_task mental model for coroutines: Cooperative Threads PartialResult middle_function () { auto r = inner_function (); return PartialResult :: from_io_result (r); }16/55 A mental model for coroutines: Cooperative0 码力 | 156 页 | 1.79 MB | 6 月前3
Coroutines and Structured Concurrency in PracticeChallenges when onboarding coroutines A lot of existing code mostly callback-based A custom-built I/O event loop predates Asio by a decade fine-tuned for specific use cases Somewhat conservative conservative audience real benefit needs to be demonstrated to justify switchingCallbacks vs coroutines // read length auto len = make_unique(); async_read(socket, buffer(len.get(), sizeof(int32_t)) use_awaitable); // ...handle data... Local variable Manual lifetime managementCallbacks vs coroutines // read length auto len = make_unique (); async_read(socket, buffer(len.get(), sizeof(int32_t)) 0 码力 | 103 页 | 1.98 MB | 6 月前3
How Meta Made Debugging Async Code Easier with Coroutines and Senders0 码力 | 131 页 | 907.41 KB | 6 月前3
Behavioral Modeling in HW/SW Co-design Using C++ CoroutinesJeffrey E. Erickson cppcon 2023 1cppcon 2023 Behavioral Modeling in HW/SW Co-design using C++ coroutines Jeffrey E Erickson, Ph.D. Sebastian Schönberg, Ph.D.© 2023 Intel Corporation and Jeffrey E. Erickson Jeffrey E. Erickson cppcon 2023 8 Coroutines are an enabling language feature • To date, coroutines have been about execution and workloads • In the modeling context, coroutines… • Provide syntactic sugar Handle parallelism in a way that isn’t clunky • Scale across large and complex HW interactions But, coroutines lack comprehensive standard library support • We used concurrencppIntel Confidential Department0 码力 | 44 页 | 584.69 KB | 6 月前3
Coroutine Patterns and How to Use Them: Problems and Solutions Using Coroutines in a Modern Codebaseknowledge Francesco Zoffoli - Coroutine Patterns and How to Use Them - CppCon 2023 5Motivation Coroutines introduce new paradigm Francesco Zoffoli - Coroutine Patterns and How to Use Them - CppCon 2023 CppCon 2023 11Overview – Executor • Executes synchronous functions • Could be multi-threaded • Coroutines are split in synchronous functions Francesco Zoffoli - Coroutine Patterns and How to Use Them CppCon 2023 19 [1] https://ericniebler.com/2020/11/08/structured-concurrency/Lifetime Member coroutines implicitly capture this Francesco Zoffoli - Coroutine Patterns and How to Use Them - CppCon0 码力 | 70 页 | 1.45 MB | 6 月前3
Interesting Upcoming Features from Low Latency, Parallelism and Concurrencyfminimum_num, fmaximum_num: Treat NaNs as missing data, -0 < +0. Hardware Support ● Many GPUs have native atomic float min/max ● CPU support growing (e.g. ARM v8.1) ● Hardware treats -0 < +0 and NaN as fetch_fmaximum_num(float, memory_order = memory_order::seq_cst) noexcept;Performance Considerations Native atomic operations vs. CAS loops. Significant performance difference in highly concurrent systems systems Careful consideration of corner cases: NaNs and signed zeros Performance implications: Native atomic operations vs. CAS loops New atomic float min/max operations Semantics close to hardware0 码力 | 56 页 | 514.85 KB | 6 月前3
Exceptional C++shouldn't prevent any of optimizations stacktrace should be usable in contract violation handler, coroutines, handler functions, parallel algorithms2021 Victor Ciura | @ciura_victor - Exceptional C++class stacktrace_entry { public: using native_handle_type = implementation-defined; ... constexpr native_handle_type native_handle() const noexcept; constexpr explicit operator 0 码力 | 113 页 | 24.39 MB | 6 月前3
Combining Co-Routines and Functions into a Job System(*function)() • struct Function{}: std::function, thread, type and id for logging • Tags • Coroutines of type Coro • Thread, type and id with operator() • std::tuple and std::vector containing and Functions into a Job System - CppCon 2021 18 / 39 Coroutines • Normal functions (synchronous) • Stack frame • Gone after return • Coroutines (asynchronous) can • Suspend to wait for a result, resume Hlavacs – Combining Co-Routines and Functions into a Job System - CppCon 2021 20 / 39 Coroutines in VGJS • Coroutines are created by calling them Coro retObj = driver(13); //create coro fr, return 0 码力 | 39 页 | 1.23 MB | 6 月前3
Working with Asynchrony Generically: A Tour of C++ ExecutorsUnder the hood of a concurrent operation 5. Implementing a simple algorithm 6. Senders and coroutines Part 2: 1. Structured concurrency 2. Cancellation 3. An extended example3 GOALS FOR THE EXECUTORS of abstractions (aka, concepts) derived from the algorithms • Efficient interoperability with coroutines • An open and extensible way to specify where, how, and when work should happen … including some async algorithms: • E.g., then, when_all, sync_wait, let_* • Utilities for integration with C++20 coroutines5 Example 1: Launching concurrent work6 EXAMPLE: LAUNCHING CONCURRENT WORK namespace ex = std::execution;0 码力 | 121 页 | 7.73 MB | 6 月前3
共 135 条
- 1
- 2
- 3
- 4
- 5
- 6
- 14
相关搜索词
FromFunctionstoCoroutinesDecipheringC++andStructuredConcurrencyinPracticeHowMetaMadeDebuggingAsyncCodeEasierwithSendersBehavioralModelingHWSWCodesignUsingCoroutinePatternsUseThemProblemsSolutionsModernCodebaseInterestingUpcomingFeaturesfromLowLatencyParallelismExceptionalCombiningRoutinesintoJobSystemWorkingAsynchronyGenericallyTourofExecutors













