知识卡片
异步隔离阻塞操作
普通文件的性能通常受存储设备、系统缓存及后端限制。异步 API 可能通过阻塞工作池执行系统调用,然后唤醒等待的任务。直接在运行时工作线程调用阻塞 API 会占住工作线程,工作池本身也需要并发与队列上限。原书提到特定平台的 io_uring 作为另一类后端。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Chapter 1. Introduction to Async 文件 I/O 与任务阻塞 · 查看原书依据
At the time of this writing, async file reads are not actually sped up by async. This is because file I/O operations are still bound by disk performance, so the bottleneck is in the disk write and read speed rather than CPU. What async can do, however, is make sure that while your file I/O is occurring, your program can continue and is not blocked
参考来源
- 位置:《Async Rust Unleashing the Power of Fearless Concurrency (Maxwell Flitton, Caroline Morton)》第01章《Chapter 1. Introduction to Async》,文件 I/O 与任务阻塞(来源项目 book-source,extracted/Async Rust Unleashing the Power of Fearless Concurrency (Maxwell Flitton, Caroline Morton)/_epub-src/OEBPS/ch01.html#id7)
- 结论依据:原书解释文件吞吐仍受存储设备约束,异步等待允许其他工作继续。
- 原始内容:At the time of this writing, async file reads are not actually sped up by async. This is because file I/O operations are still bound by disk performance, so the bottleneck is in the disk write and read speed rather than CPU. What async can do, however, is make sure that while your file I/O is occurring, your program can continue and is not blocked