知识卡片

普通读书笔记卡 · 3666.a.2

sync在消费子结果前建立汇合

理解等级:中级

父过程在使用spawn子过程返回值前须执行sync,等待此前派生的子过程结束;

否则可能读取尚未赋值的结果。过程返回前也可隐含一次sync。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 第26章 并行算法 · 查看原书依据

      The keyword sync indicates that the procedure must wait as necessary for all its spawned children to finish before proceeding to the statement after the sync—the “join” of a fork-join parallel computation. The P-FIB

    参考来源

    - 位置:《算法导论(第4版)》第26章《并行算法》(OEBPS/chapter026.xhtml,文本字符[10000,15000))。 - 结论依据:26.1节说明sync等待所有已派生子过程及其必要性。 - 原始内容:The keyword sync indicates that the procedure must wait as necessary for all its spawned children to finish before proceeding to the statement after the sync —the “join” of a fork-join parallel computation. The P-F IB