A synchronization aid that allows a set of threads to all wait for each other to reach a common barrier point. CyclicBarriers are useful in programs involving a fixed sized party of threads that must occasionally wait for each other. The barrier is called cyclic because it can be re-used after the waiting threads are released.
Questions tagged [cyclicbarrier]
70 questions
0
votes
1 answer
CyclicBarrier misunderstanding
I tried to run example with CyclicBarrier from one of tutorials:
Service man should fill empty printers when the queue of empty printers is 3.
But when I ran the code it appears that printers are filled with 2, 3 or 4 empty printers in the…

Jack
- 435
- 2
- 6
- 16
0
votes
1 answer
CyclicBarrier to lauch parallel thread doing different logic
The code below does not seem to be running in parallel but issuing one request after the other even calling await() method on each individual thread. Can somebody help with making this thread calls in parallel.
public class XYZ {
private…

javadee
- 75
- 1
- 7
0
votes
3 answers
Control Multithreading in Java
I have one "Runnable" threads which is initiating few "Callable" threads and I want to display results when all above threads has finished their jobs.
What is the best way to do it?
My code is as follows
Connector.java (Starting Runnable Thread)
…

user1653773
- 373
- 1
- 5
- 18
0
votes
1 answer
CyclicBarrier code not working?
I got CyclicBarrier code from oracle page to understand it more. I modified it and now having one doubt.
Below code doesn't terminate but If I uncomment Thread.sleep condition, It works fine.
import java.util.Arrays;
import…

Sohan Badaya
- 365
- 4
- 15
0
votes
1 answer
Implementing a cyclicbarrier in java using semaphores
The question is as follows, since the barrier is only called using down() so that it would wait for the n threads to arrive and then execute all n threads together in the critical region now how do I inform the threads calling on barrier.down that…

MedoAlmasry
- 452
- 5
- 19
0
votes
2 answers
implementing cyclicbarrier using threads and semaphores for specific thread types in java
public class cyclicBarrier {
private static int n;
private static int count;
private static semaphore mutex;
private static semaphore turnstile;
private static semaphore turnstile2;
public cyclicBarrier(int n){
…

MedoAlmasry
- 452
- 5
- 19
0
votes
1 answer
Exclude a specific thread from CyclicBarrier
For my homework I have to make a game of several kings moving across the chess board. Each king must move from his unique starting to unique ending position in own thread. Before making his move king must sleep for up to 10 milliseconds (a bit of…

Tjaz Brelih
- 65
- 7
0
votes
1 answer
CyclicBarrier and CountDownLatch?
What is the difference between CyclicBarrier and CountDownLatch? I thnik there is subtle difference, as both looks same.
Please let me know if I am wrong and also explain same.

user900721
- 1,417
- 4
- 17
- 29
-1
votes
2 answers
Why my cyclicBarrier is null?
Im learnign about ciclycbarrier and im trying to create a little app. The constructor of my app is the follow:
public FileDownloader(String line, int maxDownload){
this.position = 0;
this.line = line;
this.maxDownload = maxDownload;
…

BarneyL. BarStin
- 333
- 1
- 7
- 20
-1
votes
1 answer
how to kill threads using cyclic barrier
Is there a way to kill all the threads waiting for cyclic barrier to complete.
In my scenario I have 3 threads which if meet at point A then only proceed otherwise the process should be killed. I have used cyclic barrier to check if all three…

shruti rawat
- 241
- 1
- 7
- 19