知识卡片
并行分支互不干扰可消除竞争
为得到确定性结果,逻辑并行的分支对共同内存位置只读不写。
检查范围要包含分支调用的子程序;这个条件比只检查顶层循环语句更严格。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 第26章 并行算法 · 查看原书依据
To ensure that algorithms are deterministic, any two strands that operate in parallel should be mutually noninterfering: they only read, and do not modify, any memory locations accessed by both of them.
参考来源
- 位置:《算法导论(第4版)》第26章《并行算法》(OEBPS/chapter026.xhtml,文本字符[45000,50000))。
- 结论依据:第26章“Determinacy races”段:并行 strands 的共同访问位置只能读;parallel for 迭代和 spawn/sync 父子分支的互不干扰检查均须包括所调用子程序。
- 原始内容:To ensure that algorithms are deterministic, any two strands that operate in parallel should be mutually noninterfering : they only read, and do not modify, any memory locations accessed by both of them.
- 子程序旁证(文本字符[45000,50000)):Consequently, in a parallel for construct, such as the outer loop of P-M AT -V EC , we want all the iterations of the body, including any code an iteration executes in subroutines, to be mutually noninterfering.