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 THE 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, compute resource (aka, scheduler) • A unit of lazy async work (aka, sender) • A completion handler (aka, receiver) • A small, initial set of generic async algorithms: • E.g., then, when_all, sync_wait,0 码力 | 121 页 | 7.73 MB | 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
基于 Rust Arrow Flight 的物联网和时序数据传输及转换工具 霍琳贺• 安全性 • 高性能 • 跨平台兼容 • 强大的类型系统和抽象表达能力 • 优秀的 Rust 生态和开发工具链 • C FFI 互操作能力 • async/await 异步编程 Rust - Crates Used in taosX • Async runtime: https://crates.io/crates/tokio • Job Scheduler: https://crates Parquet: https://crates.io/crates/parquet • CSV: https://crates.io/creates/csv-async • Compression: https://crates.io/crates/zstd • Async Hashmap:https://crates.io/crates/dashmap Arrow • Schema with metadata0 码力 | 29 页 | 2.26 MB | 1 年前3
使用硬件加速Tokio - 戴翔for writing async code. Rust has very strict backward compatibility requirements, , and they haven't chosen to lock- in a specific runtime. Why need Tokio? Rust does not provide async runtime in std Applications can process hundreds of thousands of requests per second with minimal overhead. Fast async/await reduces the complexity of writing asynchronous applications. Paired with Tokio's utilities0 码力 | 17 页 | 1.66 MB | 1 年前3
Introduction to Mobile UI Test AutomationInstallation npm install nativescript-dev-appium --save-dev npm install -g appium -wd -tslib(async/await) -mocha -typings -reporting If you don’t configure it, it won’t work. ;) Appium config file: waitForExist() waitForNotExist() getAttribute() source() size() location() exists() text() Typings Async/Await Image Comparison driver.compareScreen("page.png"); Open source cloud builds - Sauce Labs0 码力 | 41 页 | 4.75 MB | 1 年前3
C++20: An (Almost) Complete OverviewTemplated Lambda Expressions Pack Expansion in Lambda Captures constexpr Changes virtual functions union, try/catch, dynamic_cast, typeid allocations constexpr string & vector Concurrency [[unlikely]] Calendars & Timezones std::span Feature Test Macros Immediate Functions – consteval constinit Class Enums and using Directive Text Formatting Math Constants Advantages Replace header files Modules explicitly state what should be exported (e.g. classes, functions, …) Separation into module interface files and module implementation files is possible but not 0 码力 | 85 页 | 512.18 KB | 6 月前3
Bringing Existing Code to CUDA Using constexpr and std::pmr• Introduction • Memory • Host vs Device Functions • Return on Investment • Concluding remarks Outline 2 |• I work the RiskLab team at CSIRO on applied mathematics for Financial Risk. • The aim of auto const N = x.size(); vectory(N, &device_mem); } Memory Allocation Across Functions 32 |Questions About Memory Allocation? 33 |Host vs Device FunctionsExecution Space Specifiers ) Experimental flag: Allow host code to invoke __device__constexpr functions, and device code to invoke __host__constexpr functions. Note that the behavior of this flag may change in future compiler 0 码力 | 51 页 | 3.68 MB | 6 月前3
共 18 条
- 1
- 2













