Graphics Programs Reference
In-Depth Information
current program provides the implementor with a powerful debugging tool:
observe that this is the dynamic behaviour of the static model and there-
fore summarizes all possible run time behaviour of the program. Moreover,
measurements performed on these sample executions allow the probability
distributions of model states to be estimated.
10.2
The Automatic Translation from Programs
to GSPNs
PN models can be obviously utilized to describe the control flow (flowchart)
of a program. For example the model depicted in Fig. 10.1 represents the
following piece of C-like code:
if (cond1)
A
else
do B while (cond2)
Observe that all decisions are represented as nondeterministic choices be-
tween two conflicting transitions (t cond1 and t ∼cond1 ), while, of course, at run
time the choice is deterministically based on the evaluation of the condition
cond1.
PN models can also faithfully represent many constructs proper of con-
currency and communication: for example, we have already seen in Chap-
ters 1, 5, and 6 how to model a fork and join construct. In this chapter we
shall explain how it is possible to compile a concurrent application into a
GSPN system: to do this we need first to define the language of the appli-
cation and then to illustrate the translation process.
10.2.1
Languages of interest
The class of concurrent programs that we consider for the automatic trans-
lation conforms to a CSP style: a typical application is organized as a set
of processes that include statements of type SEQ (sequence of statements),
ALT (nondeterministic choice among a set of possible communications),
PAR (parallel activation of processes), if, while (repeat, for), ? and !.
The two operators ? and ! are used to indicate inputs and outputs on a
channel. Communications are of the rendez-vous style, i.e. both partners of
a communication need to be ready to exchange the data (one ready for an
input and one for an output) before the communication can actually take
place. Communication among processes is assumed to happen through de-
clared common channels. This is the mechanism provided by Occam [ 43]
and it represents a generalization of the basic mechanism of CSP.
 
 
 
Search WWH ::




Custom Search