barrier Questions

2

Solved

How do you store an std::barrier as a class member, Because the completion function can be a lambda, you can't type it properly, and using an std::function< void(void) noexcept > won't work e...
Concordat asked 26/9, 2022 at 12:40

3

Solved

I am trying to implement a Thread-Safe PhoneBook object. The phone book should be able to add a person, and look up a person based on their name and phoneNumber. From an implementation perspective ...

1

Solved

I came across this code for a simple implementation of a barrier (for code that can't use std::experimental::barrier in C++17 or std::barrier in C++20) in C++ Concurrency in Action book. [Edit] A b...
Tightrope asked 15/8, 2022 at 4:33

4

Solved

I'm currently training for an OS exam with previous iterations and I came across this: Implement a "N Process Barrier", that is, making sure that each process out of a group of them wait...

4

Solved

I've been trying to get a project rid of every boost reference and switch to pure C++11. At one point, thread workers are created which wait for a barrier to give the 'go' command, do the work (sp...
Collector asked 28/6, 2014 at 9:42

2

What are some good ways to adapt this Barrier example to handle two differences: the number of items is not known in advance (for example, in the case where splitting a large file into lines) wit...
Heiskell asked 5/7, 2017 at 3:7

3

Solved

I found that the working mechanism of dispatch_barrier_async is that it is only executed once all of the blocks previously added to the queue have been completed. It works similar to the serial que...
Vertex asked 1/10, 2016 at 4:19

1

Solved

C++20 std::barrier has arrive_and_wait method, which is what pretty much every synchronization barrier implementation has. But it also has separate arrive and wait. Why do these functions exist?
Coursing asked 27/7, 2020 at 16:17

2

A codebase has a COMPILER_BARRIER macro defined as __asm__ volatile("" ::: "memory"). The intent of the macro is to prevent the compiler from re-ordering reads and writes across the barrier. Note t...
Thant asked 26/7, 2016 at 2:54

1

Solved

Consider the following program: int i{0}; std::experimental::barrier b{2}; int main() { std::thread t0{[] { b.arrive_and_wait(); std::cout << i << '\n'; }}; std::thread t1{[] { ...
Fabrice asked 20/11, 2018 at 11:6

1

Solved

Is there a way to add a thread to already pre-defined barrier? The scenario: I have at certain point of time N threads, and the code declares the Barrier in order to handle them. The problem is, ...
Effulgent asked 2/10, 2018 at 19:48

2

Solved

I've been reading on compiler optimizations vs CPU optimizations, and volatile vs memory barriers. One thing which isn't clear to me is that my current understanding is that CPU optimizations and ...
Inattentive asked 26/12, 2017 at 7:17

3

Solved

Unlike barrier() (which I think I understand), mem_fence() does not affect all items in the work group. The OpenCL spec says (section 6.11.10), for mem_fence(): Orders loads and stores of a work...
Neglect asked 6/10, 2011 at 12:3

1

So I know that you can create barriers in C to control the flow of a threaded program. You can initialize the barrier, have your threads use it, and then destroy it. However, I am unsure whether or...
Georgettegeorgi asked 30/3, 2016 at 19:57

4

Solved

How can we implement dispatch_barrier_async's equivalent behavior using NSOperationQueue or any user-defined data-structure based on NSOperationQueue? The requirement is, whenever a barrier operat...

1

Solved

The boost library (before the C++11 standard), offered support for threads. As part of its support, it also offers the implementation of a "barrier", a simple class which allows synchronization. To...
Irresoluble asked 4/10, 2014 at 7:56

2

Solved

What I understand is, that one master process sends a message to all other processes. All the other processes in return send a message to the master process. Would this be enough for a barrier to w...
Heyday asked 7/2, 2014 at 11:21

3

I wrote some lock-free code that works fine with local reads, under most conditions. Does local spinning on a memory read necessarily imply I have to ALWAYS insert a memory barrier before the spin...
Aromaticity asked 25/7, 2011 at 0:31

3

Solved

I understand that DSB, DMB, and ISB are barriers for prevent reordering of instructions. I also can find lots of very good explanations for each of them, but it is pretty hard to imagine the case t...
Pollypollyanna asked 19/3, 2013 at 4:56

2

Solved

In OpenCL, my understanding is that you can use the barrier() function to synchronize threads in a work group. I do (generally) understand what they are for and when to use them. I'm also aware tha...
Tyrelltyrian asked 31/7, 2011 at 15:19

3

For some reasons I have to stick to .NET 3.5 and I need a functionality of Barrier class from .NET 4. I have a bunch of threads that do some work and I want them to wait for each other until all ar...
Orbit asked 31/7, 2011 at 13:52

3

Solved

In a past question, I asked about implementing pthread barriers without destruction races: How can barriers be destroyable as soon as pthread_barrier_wait returns? and received from Michael Burr ...
Schaerbeek asked 4/8, 2011 at 3:8

2

Solved

Recently, I am reading some Linux kernel space codes, I see this uint64_t used; uint64_t blocked; used = atomic64_read(&g_variable->used); //#1 barrier(); //#2 blocked = atomic64_read(&amp...
Madai asked 2/7, 2011 at 6:28

2

Solved

This question is based on: When is it safe to destroy a pthread barrier? and the recent glibc bug report: http://sourceware.org/bugzilla/show_bug.cgi?id=12674 I'm not sure about the semaphores ...
Garnish asked 4/5, 2011 at 16:22

1

Solved

So my question in C is: what is basically the differences (maybe pros and cons) of using a pthread barrier (init and wait..etc) compared to using the pthread Join in a loop. So say I created 10 th...
Brakeman asked 6/12, 2010 at 4:33

© 2022 - 2024 — McMap. All rights reserved.