Questions tagged [barrier]

A barrier is a synchronization method for a group of threads or processes and means they must stop at this point and cannot proceed until all other threads/processes reach this barrier.

A barrier is a synchronization method for a group of threads or processes and means they must stop at this point and cannot proceed until all other threads/processes reach this barrier.

References

252 questions
4
votes
2 answers

Vullkan compute shader caches and barriers

I'm trying to understand how the entire L1/L2 flushing works. Suppose I have a compute shader like this one layout(std430, set = 0, binding = 2) buffer Particles{ Particle particles[]; }; layout(std430, set = 0, binding = 4) buffer…
alagris
  • 1,838
  • 16
  • 31
4
votes
1 answer

about pthread_barrier_wait

I'm using pthread_barrier_wait to synchronize threads, but in my program there is a possibility that one or more of the threads expire while others are waiting for them to reach pthread_barrier_wait. Now is there a way, that threads stuck at…
MetallicPriest
  • 29,191
  • 52
  • 200
  • 356
4
votes
2 answers

Python 2.7 Multiprocessing Barrier

I am using Python 2.7, and have been converting multithreaded code to multiprocessing code to avoid GIL lock problems. However, I don't see a barrier implementation in the multiprocessing module (Any ideas how to implement one?). I saw this…
mas
  • 345
  • 5
  • 18
4
votes
1 answer

Why rendezvous with semaphore solution doesn't generalize (and we use barrier instead)?

For rendezvous problems we need to synchronize two threads, and here is a classic solution: aArrived = S(0); bArrived = S(0); Thread A: while(true) { doSomething(); aArrived.signal(); bArrived.wait(); } Thread B: while(true) { …
4
votes
4 answers

What is the correct way to implement thread barrier, and barrier resetting in C?

I tried to implement a simple barrier in my code that looks like this: void waitOnBarrier(int* barrier, int numberOfThreads) { atomicIncrement(barrier); // atomic increment implemented in assembly while(*barrier < numberOfThreads); } And…
user1483597
  • 540
  • 2
  • 4
  • 20
4
votes
3 answers

What would be a realworld example of use of a barrier in a multithreaded application?

JDK's concurrency package, Boost's thread library, Perl's Thread library (not in Python though) all implement barrier, I haven't come across a need for using a barrier, so wondering what would a typical use case be in multi-threaded applications.
Murali VP
  • 6,198
  • 4
  • 28
  • 36
4
votes
2 answers

Least intrusive compile barrier for Java on x86

If I hava a Java process interacting with some other process via a shared ByteBuffer or similar, what would be the least intrusive equivalent of a compiler barrier in C/C++? No portability is required - I am specifically interested in x86. For…
jmetcalfe
  • 1,296
  • 9
  • 17
3
votes
1 answer

How to fix an error `libcrypto.so.3: cannot open shared object file: No such file or directory"?

Premise I want to share a single keyboard between two computers(ArchLinux and Windows), and there are some options to realize it on. I choiced an option using Barrier. Expect Following steps bellow on a ArchLinux machine and verify there are no…
koijigen
  • 166
  • 1
  • 2
  • 8
3
votes
1 answer

How to use C++ std::barrier arrival_token?

I keep getting a compiler error when using the std::barrier arrive and wait functions separately. I've been trying to find examples of using these functions but I can't find them so I'm just shooting wild at this point. It complaines that my arrival…
Elias Fyksen
  • 879
  • 9
  • 12
3
votes
0 answers

Can't add second barrier in constraint layout

I'd like to create a constraint layout where I can add multiple barrier, but it doesn't work. In the end I'd like to have a layout something like a setting page, where the elements are under each other, but when I click on some of the element, some…
Razero
  • 321
  • 1
  • 4
  • 16
3
votes
2 answers

Vulkan: attachment synchronisation with implicit layout transitions

I have read almost everything that google gave me to this topic and haven't been able to reach a satisfactory conclusion. It's essentially a follow up question to this one: Moving image layouts with barrier or renderpasses Assume I have a color…
S. Jordan
  • 115
  • 5
3
votes
1 answer

Synchronizing producer/consumer with a barrier

I have a producer thread which produces work for three consumer threads. When work has been produced, the producer thread waits until the consumer threads have finished handling the work. The producer thread then goes on handling the results.…
Bobface
  • 2,782
  • 4
  • 24
  • 61
3
votes
1 answer

Modification to "Implementing an N process barrier using semaphores"

Recently I see this problem which is pretty similar to First reader/writer problem. Implementing an N process barrier using semaphores I am trying to modify it to made sure that it can be reuse and work correctly. n = the number of threads count =…
3
votes
3 answers

Why we do not use barriers in User space

I am reading about memory barriers and what I can summarize is that they prevent instruction re-ordering done by compilers. So in User space memory lets say I have b = 0; main(){ a = 10; b = 20; c = add(a,b); } Can the compiler reorder this code…
3
votes
2 answers

Why a "barrier()" is enough for disabling or enabling the preemption?

From Linux kernel code,I can see the preempt_enable() and preempt_disable() are nothing except just barrier(): #define preempt_disable() barrier() #define preempt_enable() barrier() I can't understand it. Why just a barrier() is…
Nan Xiao
  • 16,671
  • 18
  • 103
  • 164
1 2
3
16 17