TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Race Conditions Can Be Useful for Parallelism

85 pointsby g0xA52A2Aover 2 years ago

6 comments

bheadmasterover 2 years ago
Slight nitpick - the definition of &quot;race condition&quot; on Wikipedia [0] is:<p><pre><code> [...] the condition of an electronics, software, or other system where the system&#x27;s substantive behavior is dependent on the sequence or timing of other uncontrollable events </code></pre> If we take the first example - Parallel BFS - the correctness of the output could be considered &quot;system&#x27;s substantive behavior&quot;. Properly implemented atomic checks (as demonstrated) would still guarantee to lead to correct output in all possible combinations of events. Therefore, the system&#x27;s &quot;substantive behavior&quot; is <i>not</i> dependent on the sequence or timing of other uncontrollable events. Therefore, there is no &quot;race condition&quot; involved.<p>Of course, the term &quot;race condition&quot; here is taken colloquially, for the sake of familiarity to the reader - the article has correctly recognized that the appropriate term for this kind of behavior is &quot;non-determinism&quot;.<p>[0] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Race_condition" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Race_condition</a>
评论 #33055399 未加载
评论 #33055992 未加载
评论 #33055201 未加载
评论 #33055751 未加载
评论 #33058219 未加载
评论 #33055187 未加载
compressedgasover 2 years ago
This reminds me of Kuper and Newton&#x27;s LVars paper that introduces lattice variables in Haskell: <a href="https:&#x2F;&#x2F;users.soe.ucsc.edu&#x2F;~lkuper&#x2F;papers&#x2F;lvars-fhpc13.pdf" rel="nofollow">https:&#x2F;&#x2F;users.soe.ucsc.edu&#x2F;~lkuper&#x2F;papers&#x2F;lvars-fhpc13.pdf</a> <a href="http:&#x2F;&#x2F;dx.doi.org&#x2F;10.1145&#x2F;2502323.2502326" rel="nofollow">http:&#x2F;&#x2F;dx.doi.org&#x2F;10.1145&#x2F;2502323.2502326</a>
评论 #33056040 未加载
layer8over 2 years ago
&gt; I’m not talking about data races. Data races are typically bugs, by definition.<p>One notable exception is the Racy Single-Check Idiom: <a href="http:&#x2F;&#x2F;javaagile.blogspot.com&#x2F;2013&#x2F;05&#x2F;the-racy-single-check-idiom.html" rel="nofollow">http:&#x2F;&#x2F;javaagile.blogspot.com&#x2F;2013&#x2F;05&#x2F;the-racy-single-check-...</a><p>It is particularly suitable for lazy initialization in code that is typically (but not necessarily) executed single-threaded, and is famously used in Java’s <i>String.hashCode()</i> implementation.
评论 #33056694 未加载
heydenberkover 2 years ago
I appreciate a provocative title, but I think the practical lesson in almost all cases is the inverse: fixing race conditions can introduce performance bottlenecks.
评论 #33056007 未加载
touisteurover 2 years ago
Tell me about non guaranteed order of operations in GPU reductions and floating point results changing slightly between two runs. Yes it&#x27;s useful and you get the goddamn FP32 TFLOPS, but damn it makes testing, validating, qualifying systems harder. And yes, I know one shouldn&#x27;t rely and test on equality, but not knowing the actual order of FP operations makes numerical analysis of the actual error harder (just take the worst case of every reduction, ugh).<p>EDIT: and don&#x27;t get me started on tensor cores and clever tricks to have them do &#x27;fp32-alike&#x27; accuracy. Yes, wonderful magic but how do you reason about these new objects without a whole new slew of tools.
评论 #33055990 未加载
hegelstoleitover 2 years ago
If you&#x27;re just doing BFS why do you care who the parent is? Why not just choose the parent to be the predecessor? I.e if you visit 4 from 1, then 1 is the parent. Why do you need to check a list of potential parents?
评论 #33057843 未加载