|
jbarrier | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.bonn.cs.net.jbarrier.barrier.AbstractBarrier
edu.bonn.cs.net.jbarrier.barrier.ButterflyBarrier
public class ButterflyBarrier
Implementation of a butterfly barrier algorithm. The butterfly barrier was introduced in the following article:
E. D. Brooks III. "The Butterfly Barrier". In International Journal of Parallel Programming, volume 15, pages 295-307, 1986.
A good introduction to different barrier synchronization algorithms an be found in the following technical report:
C. Ball and M. Bull. "Barrier Synchronisation in Java".
At the time of writing the report is available online at www.ukhec.ac.uk/publications/reports/synch_java.pdf
Nested Class Summary | |
---|---|
protected class |
ButterflyBarrier.ButterflyBarrierParty
Stores data required by each party that uses the barrier. |
Field Summary | |
---|---|
protected boolean |
flagOut_
Global out flag (only used if there is a barrier action). |
protected int |
numRounds_
The number of rounds used for the barrier. |
protected ButterflyBarrier.ButterflyBarrierParty[] |
parties_
The barrier information associated to each competitor thread. |
Fields inherited from class edu.bonn.cs.net.jbarrier.barrier.AbstractBarrier |
---|
action_, genericReductor_, numParties_ |
Constructor Summary | |
---|---|
ButterflyBarrier(int numParties)
Constructor (if no action is used). |
|
ButterflyBarrier(int numParties,
java.lang.Runnable action)
Constructor. |
|
ButterflyBarrier(int numParties,
java.lang.Runnable barrierAction,
GenericReductor genericReductor)
Constructor. |
Method Summary | |
---|---|
void |
await(int threadId)
Called by a party that reaches the barrier. |
protected void |
setUpParties()
Sets up the parties array, intended to be overridden in subclasses. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final int numRounds_
protected ButterflyBarrier.ButterflyBarrierParty[] parties_
protected volatile boolean flagOut_
Constructor Detail |
---|
public ButterflyBarrier(int numParties, java.lang.Runnable barrierAction, GenericReductor genericReductor)
numParties
- the number of parties that must reach the barrier before the
barrier is trippedbarrierAction
- the command to execute when the barrier is tripped, or
null
if there is no actiongenericReductor
- an optional generic reductor
java.lang.IllegalArgumentException
- if numParties
is not a power of twopublic ButterflyBarrier(int numParties, java.lang.Runnable action)
numParties
- the number of parties that must reach the barrier before the
barrier is trippedaction
- the command to execute when the barrier is tripped, or
null
if there is no action
java.lang.IllegalArgumentException
- if numParties
is not a power of twopublic ButterflyBarrier(int numParties)
numParties
- the number of parties that must reach the barrier before the
barrier is tripped
java.lang.IllegalArgumentException
- if numParties
is not a power of twoMethod Detail |
---|
protected void setUpParties()
public void await(int threadId)
await
in interface Barrier
await
in class AbstractBarrier
threadId
- the ID of the party
|
jbarrier | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |