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
0
votes
1 answer

How to synchronize a process with random number of active threads?

I have the following problem. My process spawns 4 threads, which perform the same task independently and need to wait for all of them to finish the processing before going to the next processing iteration. However, the number of active threads,…
0
votes
1 answer

Register new thread to already defined barrier

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, that sometimes I may need another new thread to be…
Shahar Shokrani
  • 7,598
  • 9
  • 48
  • 91
0
votes
0 answers

Why do python Processes behave differently with barrier.wait()?

TLDR Selecting the process that gets 0 back from barrier.wait() biases the order of the processes on the next iteration. Why? Full Story The below problem is a simple version of my actual problem. Lets say I have the following multiprocessing…
0
votes
2 answers

Java concurrency barrier example deadlock

I am trying to implement custom Barrier example in order to learn more about concurrency in Java. I have a runnable class: public class Barrier implements Runnable { private static Semaphore barrier = new Semaphore(0); private static int…
Rango
  • 229
  • 1
  • 4
  • 14
0
votes
0 answers
0
votes
1 answer

MPI Isend and Ireceive doesn't work

I have a problem with using Isend and Ireceive. I am trying to send a message to all other processors and after that receiving the same kind of messages from other processors which permormed the same Isend method. void msgs(int my_rank, int…
Cees Mandjes
  • 195
  • 12
0
votes
1 answer

MPI_BARRIER not working

Why is here the barrier not working? If I use it, the program gets blocked, otherwise I get the output in a weird order: Number of worker tasks = 4 sending 1-th element q=0.011000 to task 1 sending 2-th element q=0.012000 to task 2 received…
Open the way
  • 26,225
  • 51
  • 142
  • 196
0
votes
1 answer

How to use barrier to constraint views to top of parent

I am trying to build a layout with an image and a text side to side and center aligned together. I have an other view below these two. With a barrier below I managed to have the below text nicely constrained to the biggest of imgage/text. But I have…
Nathalie
  • 625
  • 6
  • 19
0
votes
0 answers

Implementing mutex/barrier in android Volley

I have 20-30 cars in my recycleview.I have to load their current price from API.And every 20 minutes their prices are changing.To keep up-to-date prices I have volley requests for every each of them. Problem is how to call…
Mert Doe
  • 549
  • 5
  • 15
0
votes
0 answers

barrier(CLK_LOCAL_MEM_FENCE) weird deadlock in kernel's local array when reduction

The code run well by clCreateProgramWithSource, BUT dealock by clCreateProgramWithBinary. The size of work group is (8,8), I reproduce the deadlock on Intel Graphics win8.1+ HD4600/530 and win10+HD630. local int SumAlpha[16*16/4]; int index =…
charlie
  • 65
  • 5
0
votes
1 answer

How to create a passive waiting FIFO of thread in C?

I'm trying to figure out a way to put some thread in a passive waiting mode and wake them up as they arrive to the barrier. I have a fixed amount of thread that should arrive. I was first thinking about a semaphore that i would initialise at 0 so it…
MaxUt
  • 127
  • 8
0
votes
1 answer

Barrier class with divide and conquer (mutex destroyed while busy) C++

I've tried implementing a barrier class. I want to test this using the divide and conquer algorithm. My class is defined as follows: class barrier{ private: mutex mtx; condition_variable cv; atomic counter; atomic waiting; …
SAFD
  • 145
  • 1
  • 1
  • 9
0
votes
0 answers

How to create a fair multithreading double barrier?

I have a double barrier multi-thread program working, but I don't know how to create a fair mechanism (using POSIX mutex, conditional variable barrier functions) - meaning: groups of threads will enter the first barrier by arrival time to…
user8180105
  • 27
  • 1
  • 2
0
votes
0 answers

How can I make a thread wait on any barrier in a set of barriers?

In POSIX and Windows API have barriers that allow synchronizing n threads. When n threads waiting for the barrier they may proceed doing some work. What I want is for threads to wait for a set of barriers. When any of the barriers have n threads…
Andreas
  • 5,086
  • 3
  • 16
  • 36
0
votes
1 answer

Can a thread-local copy of select elements be created of a shared 2D array in a parallel region? (Shared, private, barrier: OPenMP)

I have a 2-D grid of nxn elements. In one iteration, I'm calculating the value of one element by averaging the values of its neighbors. That is: for(int i=0;i
complextea
  • 393
  • 1
  • 5
  • 16