共识价值

发布于 2024-10-25 09:07:05 字数 111 浏览 15 评论 0原文

在阅读并发编程时,我在 Compare-And-Swap & 中遇到了术语共识数。比较并设置操作。我无法理解这个术语的含义,谁能解释一下?

谢谢你!!

while reading on concurrent programming, I came across the term Consensus Number in Compare-And-Swap & Compare-And-Set operations. I'm having trouble in understanding what is meant by this term, can anyone explain??

Thank You!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

画尸师 2024-11-01 09:07:05

共识问题是这样的......你有N个进程。每个线程都可以提议一个值,然后线程应该决定这些提议值中的一个且相同。

两个线程的示例:线程 A 建议值 A,线程 B 建议值 B。那么有效结果是两个线程都决定 A,或者两个线程都决定 B。

有不同的特殊对象或操作可用于解决共识问题。他们的力量是根据他们的共识数来分级的。这等于他们可以解决共识问题的最大线程数。

  • 共识1:正常读/写寄存器。 (即普通变量。)
  • 共识 2:测试与测试设置(又名比较和设置)、队列、堆栈等
  • 共识数 2n-2:n 寄存器分配
  • 共识数 ∞:Compare &交换等

Consensus problem is like this... You have N processes. Every thread gets to propose a value, then the threads should decide on one and the same of these proposed values.

Example for two threads: Thread A suggests value A, thread B suggests value B. Then the valid outcomes are that either both threads decide A, or that both threads decide B.

There are different special objects or operations that are useful in solving the consensus problem. Their powerfulness is graded by their consensus number. This equals the maximum number of threads for which they can solve the consensus problem.

  • Consensus number 1: Normal read/write registers. (That is, plain variables.)
  • Consensus number 2: Test & set (a.k.a. compare & set), queue, stack et.c.
  • Consensus number 2n-2: n-register assignment
  • Consensus number ∞: Compare & swap, et.c.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文