Talk:Barrier (computer science)

Wiki Education Foundation-supported course assignment
This article is or was the subject of a Wiki Education Foundation-supported course assignment. Further details are available on the course page. Student editor(s): Bzhang16.

Above undated message substituted from Template:Dashboard.wikiedu.org assignment by PrimeBOT (talk) 15:20, 16 January 2022 (UTC)

Clarifications needed
prevent the compiler from reordering other operations over the barrier statement during optimization passes.

WTF does "over the barrier" mean? Examples are in order. —Preceding unsigned comment added by 97.116.107.166 (talk) 05:38, 7 January 2010 (UTC)

Incorrect pseudocode examples
The included pseudocode examples have numerous correctness issues (ex. data races) and the notation quality is also lacking (type and/or initial values are not clear). Examples of how to use the barrier primitive(s) may also help. — Preceding unsigned comment added by 50.54.141.59 (talk) 23:08, 22 April 2017 (UTC)


 * Thanks for your comment and review on this. Please check the latest version of this article which I have updated 3 important parts with their ready-for-testing source code: Centralized Barrier, Sense-Reversal Centralized Barrier and POSIX Thread barrier functions.Anonymous Agent (talk) 17:35, 7 May 2024 (UTC)

Removed incorrect C# code sample
I removed a block of text and a code sample that explained how the C# lock syntax works. C# lock(foo) { blahblah } is just syntax sugar for C#'s vision of monitors and thus entirely distinct from the concept of a barrier. As should have been obvious from the existing text in the article.

If someone has a better sample, perhaps using a barrier primitive found in C# (if there is one), then by all means please reinstate it. As it stood, the article was more confusing than informative. 88.112.2.159 12:52, 15 July 2006 (UTC)


 * A good example of memory barrier in C#: http://www.albahari.com/threading/part4.aspx
 * The description given in this article is incorrect. A description and code sample should be taken from the link given as those are correct. 86.121.33.154 (talk) 15:43, 14 July 2010 (UTC)

Removed link to memory barrier
This page is about thread synchronization barriers, as evidenced by its content.

Memory barriers are not an implementation of these!

The link implies a strong technical connection between the two concepts, where there is a weak analogy at most.

If the link is just a signpost to the lost seeker if memory barrier knowledge, it should be labelled as such.

Its possible that the ambiguous naming of this page is at fault, in which case it should be renamed synchronization barrier. —Preceding unsigned comment added by Alexbbrown (talk • contribs) 13:34, 9 July 2008 (UTC)

Added processor and compiler barrier section
This page is named "barrier" and should not be used for synchronisation barriers only, but must give an overview of all kind of computer science related barriers. A "synchronization barrier" page may be created to contain more about the synchronization primitive. —Preceding unsigned comment added by 82.228.245.190 (talk) 14:45, 8 December 2009 (UTC)

Latch and count-down latch
I have added a paragraph to indicate use of the terms "latch" and "count-down latch" to refer to specific types of barrier. I have avoided mentioning any specific implementations (C++, Java, etc), but indicative examples for those languages could be added to the article if anyone feels so inclined. I used the terms "raised" and "lowered" to refer to the states, but I see, in the article, the terms "stop", "pass", "proceed", "set", and "clear" are used to refer to the same states; I have also seen "closed" and "open" used elsewhere. If there is a de-facto convention, it may improve this article to use accepted state names. However, I believe the particular names "raised" and "lowered" are more understandable for those less familiar with concurrent or parallel computing: outside of computer science, a barrier or flag may be raised or lowered. 148.252.133.102 (talk) 14:55, 23 February 2021 (UTC)


 * The "raised" and "lowered" names are misleading actually. I really don't know which one is which, and there is no explanation just next to those terms. You can imagine a physical barrier that you raise to open it, as well as one that you lower to open it. I also just spent a couple of minutes googling for any papers using this terminology and didn't find anything, but to be honest it is hard to find any consistent naming conventions, most texts just say "threads cannot proceed"/"thread is blocked" or similar. But I would really prefer to change this to "stop"/"pass" or anything that can be understood without ambiguity. TPReal (talk) 20:41, 3 November 2022 (UTC)