|
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.StaticTreeBarrier
public class StaticTreeBarrier
Implementation of a static tree barrier algorithm. The static tree barrier was introduced in the following article:
J. M. Mellor-Crummey and M. L. Scott. "Algorithms for Scalable Synchronization on Shared-Memory Multiprocessors". In ACM Transactions on Computer Systems, volume 9, pages 21-65, 1991.
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 |
StaticTreeBarrier.StaticTreeBarrierParty
Stores data required by each party that uses the barrier. |
Field Summary | |
---|---|
protected boolean |
flagOut_
Out flag set by the winner. |
protected java.util.concurrent.atomic.AtomicBoolean[] |
flags_
The synchronization flags (one for each party). |
protected StaticTreeBarrier.StaticTreeBarrierParty[] |
parties_
The barrier data associated to each party. |
Fields inherited from class edu.bonn.cs.net.jbarrier.barrier.AbstractBarrier |
---|
action_, genericReductor_, numParties_ |
Constructor Summary | |
---|---|
StaticTreeBarrier(int numParties)
Constructor. |
|
StaticTreeBarrier(int numParties,
java.lang.Runnable barrierAction)
Constructor. |
|
StaticTreeBarrier(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 StaticTreeBarrier.StaticTreeBarrierParty[] parties_
protected final java.util.concurrent.atomic.AtomicBoolean[] flags_
protected volatile boolean flagOut_
Constructor Detail |
---|
public StaticTreeBarrier(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 StaticTreeBarrier(int numParties, java.lang.Runnable barrierAction)
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 action
java.lang.IllegalArgumentException
- if numParties
is not a power of twopublic StaticTreeBarrier(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 |