知识卡片
过量线程增加切换负担
调度切换有保存恢复、缓存失效和任务交错等待等成本。增加线程可覆盖阻塞期间的空闲,但线程过多又使切换与缓存重建占用资源,严重时发生抖动。不能用“线程越多吞吐越大”配置服务,应通过负载和运行数据平衡并发与管理开销。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 理解性能的心智模型 · 查看原书依据
As the number of threads increases, these overhead costs increase.5 Therefore, if you have thousands of threads, the system wastes a significant amount of time doing context switching. We call this thrashing when the cost becomes excessive.
参考来源
- 位置:《Software Architecture and Decision-Making》第3章《理解性能的心智模型》(来源项目:book-sources;源文件:extracted/Software Architecture and Decision-Making Leveraging Leadership, Technology, and Product Management to Build Great Products… (Srinath Perera)/_epub-src/ch03.xhtml)
- 结论依据:原文的定义、比较或例子支持“调度切换有保存恢复、缓存失效和任务交错等待等成本”;正文据此说明用途和边界。
- 原始内容:As the number of threads increases, these overhead costs increase.5 Therefore, if you have thousands of threads, the system wastes a significant amount of time doing context switching. We call this thrashing when the cost becomes excessive.