Await-Tree Async Rust 可观测性的灵丹妙药 - 赵梓淇开发者大会 Await-Tree Async Rust 可观测性的灵丹妙药 赵梓淇 Bugen Zhao Await-Tree Async Rust 可观测性的灵丹妙药 Await-Tree 的 设计原理与实现 2 回顾 Async Rust 的设计与痛点 1 Await-Tree 的 应用与真实案例 3 Await-Tree Async Rust 可观测性的灵丹妙药 Await-Tree Await-Tree 的 设计原理与实现 2 回顾 Async Rust 的设计与痛点 1 Await-Tree 的 应用与真实案例 3 Async Rust 的优势 • 异步编程的共同优势 • async/await 关键字 • 用户态调度 • Async Rust 的独特优势 • Ownership 与 Lifetime • 无栈协程 Async Rust 回顾 Rust 的无栈协程抽象 的无栈协程抽象 — Future Async Rust 回顾 • 通过 poll 驱动的状态机 • 组合嵌套为调度单元: Task • async fn 语法糖 Async Rust 观测与调试的痛点 Async Rust 回顾 • 特性: Future 灵活的可组合性 • 任意定制 Poll 的执行逻辑 (Join / Select / Timeout) • 动态的调用关系 • 痛点:观测与调试工具无法理解灵活的执行逻辑0 码力 | 37 页 | 8.60 MB | 1 年前3
Working with Asynchrony Generically: A Tour of C++ ExecutorsGoals for the Executors proposal 2. Some simple examples, intro to senders 3. The lifecycle of an async operation 4. Under the hood of a concurrent operation 5. Implementing a simple algorithm 6. Senders EXECUTORS PROPOSAL The vision: “An asynchronous analog of the STL” • A full suite of standard async algorithms based on real-world requirements: E.g., then, when_all, sync_wait, repeat, stop_when, timeout etc. (not all proposed yet) • A standard set of abstractions (aka, concepts) derived from the algorithms • Efficient interoperability with coroutines • An open and extensible way to specify where, how0 码力 | 121 页 | 7.73 MB | 6 月前3
C++20 STL Features: 1 Year of Development on GitHubin_range(T t) noexcept;11 constexpr Algorithms12 C++20 constexpr Everything • constexpr enables compile-time programming without arcane templates • Algorithms: • P0202R3 constexprAnd And exchange() (GH-425) • P0879R0 constexpr Algorithms, Part II (GH-425, BillyONeal) • P1645R1 constexpr Algorithms (GH-399, Neargye) • More: • P0415R1 constexpr Again (GH-367, Neargye) time-efficient • Sorted arrays: binary_search, lower_bound, equal_range • Now you can use constexpr algorithms • Easy: static_assert with constexpr is_sorted • string_view is also constexpr; not limited to 0 码力 | 45 页 | 702.09 KB | 6 月前3
C++20: An (Almost) Complete Overviewrequirements Any container supporting begin()/end() is a valid range Range-based algorithms: all Standard Library algorithms accepting ranges instead of iterator pairs Projection: Transform elements0 码力 | 85 页 | 512.18 KB | 6 月前3
Learning by Contributing to Rust Compiler - 陈于康started hacking Rustc [100+ Prs] parser, diagnostics, ICE, Infra tools, code refactor, algorithms improvements Some PR stories • Rust cares about error messages • We are building a sufficiently0 码力 | 23 页 | 3.28 MB | 1 年前3
绕过conntrack,使用eBPF增强 IPVS优化K8s网络性能refer • V.S service in pure eBPF • Reuse the IPVS’s functionality and maturity • Many scheduling algorithms • Reuse IPVS timer to reclaim eBPF map • More efficient and secure • V.S Taobao IPVS SNAT patch0 码力 | 24 页 | 1.90 MB | 1 年前3
C++23: An Overview of Almost All New and Updated Featuresstd::ranges::contains_subrange(v1, v2)); // true75 Changes to Ranges Library Several folding algorithms: ranges::fold_left(), fold_left_first(), fold_right(), fold_right_last(), fold_left_with_iter()0 码力 | 105 页 | 759.96 KB | 6 月前3
CeresDB Rust 生产实践 任春韶Future Cancellation Rust 生产实践 生产实践 – Tokio 为什么使用 Tokio ? 1. 业界使用最广泛,测试齐全。 2. Tokio 支持 async/await ,提供了高效的异步锁、异步队列等。 3. Tokio 社区支持好。 生产实践 – Tokio Rust future preemption https://docs. https://rust-lang.github.io/async-book/04_pinning/01_chapter.html#why-pinning https://doc.rust-lang.org/beta/unstable-book/language-features/generators.html 生产实践 – Async lock Req0 Req1 Req2 Memory 生产实践 – Async lock runtime.spawn(task0) runtime.spawn(task1) runtime.spawn(task2) 生产实践 – Async lock runtime.spawn(task0) runtime.spawn(task1) runtime.spawn(task2) 生产实践 – Async lock 总结: Async lock:0 码力 | 22 页 | 6.95 MB | 1 年前3
Rust 异步并发框架在移动端的应用 - 陈明煜嵌入式软件能力中心 Applications of Rust Runtime in Mobile Overview of asynchronous Rust #1 Rust 异步简介 Ylong async runtime #3 Ylong Runtime 并发框架 目录 Table of Contents #2 社区并发框架介绍以及与移动端的不适配性 Introduction to third 单个任务资源占用:几十 KB -> 几百 Byte 任务切换时间 : 10 微秒 -> 100 纳秒 Rust 语言并没有提供异步并发框架, 只提供异步所需的基本特性: Future async / await Waker asyn c Future Waker poll Syntax sugar wake await Rust 异步机制 Asynchronous Rust 目前 Rust 社区最广泛使用的事件 驱动型调度框架,擅长处理大量异 步 IO 的场景。具有非常强大的生 态。 tokio 第一个适配 Rust async/await 原语 的运行时库,与 tokio 类似支持异步 IO ,目前已经半废弃 async-std 更轻量化的调度框架,功能被拆分 到其他多个库中, IO 密集场景性 能不如 Tokio smol Rayon 并非异步运行时。它通过同步0 码力 | 25 页 | 1.64 MB | 1 年前3
C++高性能并行编程与优化 - 课件 - 05 C++11 开始的多线程编程解算还能在后台继续正常 运行。虽然 zeno 也用了 opengl ,但他用多进程成功在 opengl 的百般拖后腿下实现了 并发。 第 2 章:异步 异步好帮手: std::async • std::async 接受一个带返回值的 lambda ,自身返回一个 std::future 对象 。 • lambda 的函数体将在另一个线程里执行 。 • 接下来你可以在 main 里面做一些别的事 future_status::ready 。 • 同理还有 wait_until() 其参数是一个时间点。 另一种用法: std::launch::deferred 做参数 • std::async 的第一个参数可以设为 std::launch::deferred ,这时不会创建一个 线程来执行,他只会把 lambda 函数体内 的运算推迟到 future 的 get() 被调用时。 的执行仍在主线程 中,他只是函数式编程范式意义上的异步 ,而不涉及到真正的多线程。可以用这个 实现惰性求值( lazy evaluation )之类。 std::async 的底层实现: std::promise • 如果不想让 std::async 帮你自动创建线程 ,想要手动创建线程,可以直接用 std::promise 。 • 然后在线程返回的时候,用 set_value() 设置返回值。在主线程里,用0 码力 | 79 页 | 14.11 MB | 1 年前3
共 13 条
- 1
- 2













