Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you mean memory barriers in terms of concurrency, it's just a primitive for concurrency that counts downward atomically once per participant (e.g. a group of threads) and then each atomically waits until the counter reaches zero before continuing. It's used to synchronize (i.e. put into lockstep) two concurrent processes such that they must all wait at a given point before continuing more or less all at once, often as part of a larger process.

If you mean a barrier in terms of a memory "fence", that's an event on CPUs whereby any pending memory instructions that have been pipelined and thus not committed are forced to commit and complete before continuing. Usually only relevant for a single core, but they're used to make sure that other cores will see the same memory values and your pending writes would reflect (or, conversely, sometimes making sure your own core sees the reads from other cores as fresh as possible before the actual read op).



Thank you for the comment. I mean fences.

Haven't ever heard of barriers as a counter-like primitive (sounds like a semaphore or CountDownLatch)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: