并行化异构任务的局限性
Limitations of parallelizing heterogeneous tasks
我正在阅读 Java 实践中的并发性,偶然发现一段内容是这样的:-
Under 6.3.4 Limitations of parallelizing heterogeneous tasks
A further problem with dividing heterogeneous tasks among multiple workers
is that the tasks may have disparate sizes. If you divide tasks A and B between
two workers but A takes ten times as long as B, you’ve only speeded up the total
process by 9%. Finally, dividing a task among multiple workers always involves
some amount of coordination overhead; for the division to be worthwhile, this
overhead must be more than compensated by productivity improvements due to
parallelism.
现在,如果您仔细阅读粗体部分,是否正确地说工作线程的协调开销必须超过我使用线程并行实现的性能提升?
谁能帮我理解一下吗?
不,粗体部分显着改变了句子的意思:
Finally, dividing a task among multiple workers always involves some amount of coordination overhead; for the division to be worthwhile, this overhead must be more than compensated by productivity improvements due to parallelism.
如果那只是 "must be more than the productivity improvements..." 那么你是对的。上面所说的是,通过在工作线程之间分配任务(开销)而招致的性能损失,必须 小于 通过这样做获得的性能提升。
例如,如果您的开销为 10 秒而性能提升仅为 5 秒,那么并行化操作实际上 降低了 您的整体性能。如果您的开销是 10 秒,但性能增益是 50 秒,那么您最终会减少 40 秒的总执行时间(即改进)。
另一种说法是“...这种开销必须被并行性带来的生产率提高所抵消。”。
我正在阅读 Java 实践中的并发性,偶然发现一段内容是这样的:-
Under 6.3.4 Limitations of parallelizing heterogeneous tasks
A further problem with dividing heterogeneous tasks among multiple workers is that the tasks may have disparate sizes. If you divide tasks A and B between two workers but A takes ten times as long as B, you’ve only speeded up the total process by 9%. Finally, dividing a task among multiple workers always involves some amount of coordination overhead; for the division to be worthwhile, this overhead must be more than compensated by productivity improvements due to parallelism.
现在,如果您仔细阅读粗体部分,是否正确地说工作线程的协调开销必须超过我使用线程并行实现的性能提升?
谁能帮我理解一下吗?
不,粗体部分显着改变了句子的意思:
Finally, dividing a task among multiple workers always involves some amount of coordination overhead; for the division to be worthwhile, this overhead must be more than compensated by productivity improvements due to parallelism.
如果那只是 "must be more than the productivity improvements..." 那么你是对的。上面所说的是,通过在工作线程之间分配任务(开销)而招致的性能损失,必须 小于 通过这样做获得的性能提升。
例如,如果您的开销为 10 秒而性能提升仅为 5 秒,那么并行化操作实际上 降低了 您的整体性能。如果您的开销是 10 秒,但性能增益是 50 秒,那么您最终会减少 40 秒的总执行时间(即改进)。
另一种说法是“...这种开销必须被并行性带来的生产率提高所抵消。”。