
SDFScheduler |
ptolemy.domains.sdf.kernel.SDFScheduler |
A scheduler that implements basic scheduling of SDF graphs. This
class calculates the SDF schedule in two phases. First, the balance
equations for the rates between actors are solved to determine the
firing vector (also known as the repetitions vector). The
firing vector is the least integer solution such that the number of
tokens created on each channel of each relation is equal to the number
of tokens consumed. In some cases, no solution exists. Such graphs
are not executable under SDF.
Then the actors are ordered such that each actor only fires when the
scheduler has determined that enough tokens will be present on its
input ports to allow it to fire. In cases where the dataflow graph is
cyclic, a valid firing vector exists, but no actor can fire, since
they all depend on the output of another actor. This situation is
known as deadlock. Deadlock must be prevented in SDF by manually
inserting delay actors, which represent initial tokens on each
relation. Such delay actors are responsible for creating tokens
during initialization that will prevent deadlock. These actors
set the tokenInitProduction parameter of their output ports
to represent the number of
tokens they will create during initialization. The SDFScheduler uses
this parameter to break the dependency in a cyclic
graph.
Note that this scheduler only ensures that the number of firings is
minimal. Most notably, it does not attempt to minimize the size of
the buffers that are associated with each relation. The resulting
schedule is a linear schedule (as opposed to a looped schedule) and is
not suitable for multiprocessing environments.
Any actors may be
scheduled by this scheduler, which will, by default, assume
homogeneous behavior for each actor. (i.e. each output port produces
one token for each firing, and each input port consumes one token on
each firing, and no tokens are created during initialization.) If
this is not the case then parameters named tokenConsumptionRate,
tokenProductionRate, and tokenInitProduction must be set.
The SDFIOPort class provides easier access to these parameters.
Note that reconstructing the schedule is expensive, so the schedule is
locally cached for as long as possible, and mutations under SDF should
be avoided.
Note that this scheduler supports actors with 0-rate ports as long as
the graph is not equivalent to a disconnected graph. This scheduler
is somewhat conservative in this respect.
Disconnected graphs are supported if the SDF Director parameter
allowDisconnectedGraphs is true.
Author(s): Stephen Neuendorffer and Brian Vogel
Version:$Id: SDFScheduler.java,v 1.216 2006/03/29 20:54:41 cxh Exp $
Pt.Proposed Rating:Green (neuendor)
Pt.Accepted Rating:Green (neuendor)
constrainBufferSizes
If true, then buffer sizes are fixed according to the schedule,
and attempts to write to the buffer that cause the buffer to
exceed the schedule size result in an exception. This method
works by setting the capacity of the receivers if the value is
true. This parameter is a boolean that defaults to true.