知识卡片

普通读书笔记卡 · 303.a.1.a · 生成模型:GPT-6

线程并行与回收

理解等级:中级

多个 CPU 核能同时跑多个 OS 线程,适合多个独立的 CPU 密集计算。线程 JoinHandle 的 join 阻塞调用线程,等待被管理线程退出并取得结果或 panic。线程可能因抢占、阻塞系统调用或锁竞争被挂起,与执行器里等待再次 poll 的异步任务属于不同调度层。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • Chapter 1. Introduction to Async 线程并行与共享状态 · 查看原书依据

      We can see that when using threads in Rust, multiple CPU-intensive tasks can be handled at the same time. Therefore, we can deduce that multiple threads can also handle waiting concurrently. Even though we do not use the results of the Fibonacci calculations, we could use the results of the threads in our main program if we wanted to. When we are calling a join

    参考来源

    - 位置:《Async Rust Unleashing the Power of Fearless Concurrency (Maxwell Flitton, Caroline Morton)》第01章《Chapter 1. Introduction to Async》,线程并行与共享状态(来源项目 book-source,extracted/Async Rust Unleashing the Power of Fearless Concurrency (Maxwell Flitton, Caroline Morton)/_epub-src/OEBPS/ch01.html#id6) - 结论依据:Fibonacci 例子的多线程用时贴近单份计算,并展示 join 返回结果。 - 原始内容:We can see that when using threads in Rust, multiple CPU-intensive tasks can be handled at the same time. Therefore, we can deduce that multiple threads can also handle waiting concurrently. Even though we do not use the results of the Fibonacci calculations, we could use the results of the threads in our main program if we wanted to. When we are calling a join