Title: Chapter 4 DEVS Models for Processing and Coordinating Workflow
1Chapter 4DEVS Models for Processing and
Coordinating Workflow
- Sending/Receiving/Interpreting Messages
- Processor Models
- Workflow experimental frame components
- Work Flow Coupled Models
- Experimental Frame for Workflow Performance
Measurement - Hierarchical Model Construction
- Workflow Coordinator Models
- Workflow Architecture Models
- Performance of Simple Workflow Architectures
2Sending/Receiving/Interpreting Messages how to
use casting to receive instances of arbitrary
entity subclasses
SimpArc .procQ
coupled model
entity
in
out
A
B
doubleEnt
doubletEnt(double)
double
double
getv() ? double
coupling (A,out,A,in)
public message out( ) message m new
message() m.add( makeContent("out", new
doubleEnt(1.2)) return m
in
out
cast
message
doubleEnt
add
p
getv()
val
doubleEnt
deltext(double e,message) x)if
(somethingOnPort(x,"in") entity val
getEntityOnPort(x,"in") doubleEnt f
(doubleEnt)val double v f.getv()
v
content
double
casting the received entity down to the doubleEnt
subclass
3Sending/Receiving/Interpreting Messages
(contd) multiple copies of an object are needed
to avoid hard-to-find dependencies.
SimpArc .procQ
coupled model
entity
in
out
A
B
job
- job(procTime)
- update(e)
- procTime e
- copy() return new
- job(procTime)
job
job
coupling (A,out,A,in)
This instance of job is now shared in common by
both A and B if either makes a change to its
state, then the other will also be subject to
it. For example, if B does
job.update(10) then the instance at A will be
similarly altered. This can lead to mysterious
effects (similar to quantum entanglement) where
components of a model can influence each other
outside of their interface couplings. It is
difficult to trace this kind of non-modularity.
Suppose A sends its instance of job directly to
B public message out( ) message m new
message() m.add( makeContent("out", job) return
m
The right way B stores a copy of its
input deltext(double e,message) x) if
(somethingOnPort(x,"in)) job temp
getEntityOnPort(x,"in") myJob
temp.copy() where copy() is a method you define
to create a new instance of job and give it
values of an existing one.
out
and B stores it as its instance deltext(double
e,message) x) if (somethingOnPort(x,"in")) myJob
getEntityOnPort(x,"in")
The cure is simple create a new instance as a
local copy of an entity if it is to be altered
(this happens automatically when using toString()
and toObject(), see chap. 12)
4Processor Models
SimpArc .proc
SimpArc .procQ
SimpArc .priorityQ
SimpArc job
5Processor with queue illustrating how to process
a bag of inputs (multiple concurrent events)
accumulate the inputs on port in into the queue
public class procQ extends proc protected Queue
q public procQ(String name,
double procTime ) super(name,procTime) q
new Queue()
public void deltext(double e, message x)
Continue(e) if (phaseIs("passive")) for
(int i0 ilt x.size() i) if
(messageOnPort(x, "in", i))
q.add(x.getValOnPort("in", i))
holdIn("busy", procTime) job
(entity)q.first() else if
(phaseIs("busy")) for (int i0 ilt
x.size()i) if (messageOnPort(x, "in",
i)) entity jb x.getValOnPort("in",
i) q.add(jb)
class Queue is a container with FIFO discipline
this makes sure the processed job is the one
at the front
public void deltint( ) q.remove() if(!q.isEmpty
()) job (entity)q.first() holdIn("busy",
procTime) else passivate()
remove the job at the front that was just finished
SimpArc .procQ
GenCol .Queue
6Workflow experimental frame components
- To compute the performance measures, the
transducer, places job-ids that arrive at its
'ariv input port on its arrived-list together
paired with their arrival times.When, and if, the
job-id also appears at the 'solved input port,
the transducer places it on the solved-list and
also computes its turnaround time. it maintains
its own local clock to measure arrival and
turnaround times. - In transd, an internal transition is used only to
cause an output at the - end of the observation interval. In a more
general experimental frame, the role of
terminating the simulation run would be handled
by a component - called an acceptor.
SimpArc genr
SimpArc genrRand
SimpArc transd
- The transducer measures two performance indexes
of interest for work flow the throughput and
average turnaround time of jobs in a simulation
run. - throughput is the average rate of job
departures from the architecture, - estimated by the number of jobs processed during
the observation interval, - divided by the length of the interval.
- A job's turnaround time is the length of time
between its arrival to the processor and its
departure from it as a completed job. - For the simple processor, the turnaround time is
the same as the processing time. (For more
complex architectures, this relationship is not
necessarily true as we shall see.).
generator is an autonomous model, (its behavior
is self induced by recurring internal events)
hence, it does not need an external transition
function To dictate its response to external
input events. The added an input ports start
and stop when stimulated, start and stop the
generation of outputs.
7Work Flow Coupled Models
SimpArc .pipeSimple
SimpArc netSwitch
SimpArc gpt
SimpArc ef
SimpArc efp
8Basic Workflow Coupled Model generator,
processor, transducer
SimpArc gpt
9Experimental Frame for Workflow Performance
Measurement
SimpArc ef
- Output lines may diverge to indicate the
occurrence of simultaneous events. When genr
sends out a job identifier on port out, it
goes at the same clock time, both to the ariv
port of transd and port out of ef, hence
eventually to some processor model. - Input lines may converge, i.e., two or more
source ports connected to the same destination
port, can occur. Bags represent the collection
of inputs that arrive simultaneously at a
component.
- Instances of the classes genr and transd are
coupled together to form the experimental frame,
ef. - The input port in of ef is for receiving
solved jobs which are sent to the solved input
port of transd via the external input coupling.
- There are two output ports out, which
transmits job identifiers sent to it by genr,
and 'result which transmits the performance
measures computed by transd. External output
couplings bring about both these transmissions. - There are two internal couplings
- the output port out of genr sends job
identifiers to the 'ariv port of transd - the output port out of transd which couples to
the 'stop input port of genr.
10Hierarchical Model Construction
SimpArc efp
11Example Flat Coupled Model
SimpArc gpt
gpt
start
start
out
generator (genr)
processor (proc)
out
in
stop
out
arrived
transducer (transd)
out
solved
12Experimental Frame/Model Modularity
SimpArc efp
efP
ef
start
start
start
out
out
generator (genr)
processor (proc)
out
in
stop
out
arrived
transducer (transd)
out
out
solved
solved
13Hierarchical Coupled Model
SimpArc efp
efP
ef
start
start
Processor With Queue (procQ)
out
out
in
out
out
solved
14Hierarchical Models and Experimental Frame
Modularity in DEVSJAVA
Create EF
ef.setBlackBox(true)
m.setBlackBox (true)
15Workflow Coordinator Models
public class Coord extends proc public
Coord(String name) super(name,1)
inports.add("setup") inports.add("x")
outports.add("y") public void initialize()
passivate() super.initialize()
protected void add_procs(devs p) //use devs
for signature System.out.println("Default in
Coord is being used")
Coord
SimpArc divideCoord
SimpArc pipeCoord
divide Coord
pipe Coord
multi Server Coord
SimpArc multiServerCoord
16Workflow Architecture Models
SimpArc DandC3
SimpArc pipeLine
SimpArc multiServer
17Performance of Simple Workflow Architectures
SimpArc .proc
SimpArc multiServer
SimpArc pipeline
SimpArc DandC3
Average turnaround time and maximum throughput as
a function of processing time