First, we will give an overview of the axioms and the fundamental terminology of .... of the BPA, i. e. the head of each alternative is an atomic action that may be.
Algebraic Specification of Resource-Constrained Processes Peter Rittgen, Oliver Wendt Frankfurt University Institut für Wirtschaftsinformatik (Institute of Applied Computer Science) Mertonstrasse 17 D - 60054 Frankfurt Germany email: {rittgen, wendt}@wiwi.uni-frankfurt.de
Keywords: process algebra, parallel processes, resource constraints, disjunctive edges, process graph, RCPS, PA, BPA, RCPA, axioms.
Abstract: The object of this paper is to design a theoretical framework for the algebraic specification of resource constraints. It is, insofar, intended to provide an extension of the process algebra as introduced by Bergstra & Klop (1982) as well as a formal basis for a coherent theory of the RCPS (resource-constrained project/process scheduling). First, we will give an overview of the axioms and the fundamental terminology of basic process algebra (BPA), namely sequence and alternative. Furthermore, we aquaint the reader with the concept of the (extended) process algebra (PA): interleaving via the so-called merge operator. Then, we introduce new operators and axioms into the process algebra to express and to treat restrictions on concurrent processes competing for the same resource(s). This leads us to the RCPA (resource-constrained process algebra). The aim is to generate all alternatives that do not violate any of the constraints imposed. We conclude our work describing the as yet unsolved problems on the way to a coherent theory covering all aspects of the RCPS, mainly the integration of a time component into the algebra.
Introduction The term “process algebra“ was introduced by Bergstra & Klop (1982). Prior to this, Milner (1980) and Hoare (1978) published some related work on formal languages for parallel computing, namely CCS (calculus of communicating systems) and CSP (communicating sequential processes) respectively. An excellent coverage of the major types of process algebras can be found in Baeten & Weijland (1990). The object of process algebra (PA) is to specify a mathematical theory that uses only very few operators and a limited set of axioms but is yet powerful enough to describe complex processes. As a definition of the term process Baeten & Weijland propose:
“A process is something that obeys a certain set of axioms ... for processes“. This seemingly meaningless definition points out that an axiomatic theory of processes will lead to the definition of its basic element “process“ and not vice versa. Nevertheless, the design of the axioms should correspond to the intuitive notion of a process being some sort of “event sequence“. Our aim is to extend the basic notion of process algebra to cover resource constraints on parallel processes. We use a kind of process graph to visualize algebraic terms. Resource constraints are then depicted by disjunctive edges connecting the competing processes. Additional operators are developed to represent concurrency algebraically. A set of axioms is presented that yields all valid schedules. We adopt interleaving semantics viewing atomic processes as events and using the merge operator to denote parallelism. We assume that the reader is familiar with the algebraic methodology and start with an introduction to (basic) process algebra.
Basic Process Algebra (BPA) The specification of basic process algebra is:
BPA = (Σ BPA , EBPA ) Σ BPA =
{ +,
⋅, a, b, c,
EBPA = {
L}
BPA1:
x+ y= y+ x
BPA2:
(x + y) + z =
BPA3:
x+x= x
BPA4:
(x + y) ⋅ z = (x ⋅ z) + (y ⋅ z)
BPA5:
(x ⋅ y) ⋅ z =
x + (y + z)
x ⋅ (y ⋅ z)
} Variables x, y and z are universally quantified, i. e. the equations hold for every instance of the variables, an instance being any term over the alphabet Σ. The function symbol “+“ means “alternative composition / choice“, so “x + y“ refers to the execution of either x or y (but not both). The operator “⋅“ denotes “sequential composition“, i. e. in “x ⋅ y“ x is executed first followed by y. As in “conventional“ algebra, “⋅“ binds stronger than “+“ and can be omitted.
2
The symbols a, b, c and so on stand for atomic actions, indivisible processes without duration which can best be characterized as events (excluding, of course, variable identifiers x, y and z). Plausibility of axioms BPA 1 through 5 is self-evident. But it should be noted here that while there is an axiom for distributivity on the right side (BPA 4), there is none for the left side:
x ⋅ (y + z) ≠ x ⋅ y + x ⋅ z The reason for this is a different point in time of the decision: on the right-hand side of the inequality, an immediate decision prior to any execution is required, while on the left-hand side the decision between y and z is postponed until x has been executed. So, the two terms cannot be viewed as equivalent. Applying axioms BPA 4 and BPA 5 successively yields the “head normal form“ (HNF) of the BPA, i. e. the head of each alternative is an atomic action that may be followed by yet another HNF term:
t=
L
+
(ai ⋅ ti )
+
L
+ bi +
L,
with ai, bi being atomic actions and ti being an HNF term of the same structure. Example: the term a (b + c) a has the head normal form a (b a + c a).
Event Form As mentioned above, in process algebra, processes do not have a duration. Therefore, modeling an atomic process that does have a duration requires splitting it into a begin event and an end event. Between these events, the actual process „takes place“. For example, process “a“ is denoted as (ab ⋅ ae). In this paper, all processes are assumed to have the same duration, i.e. time elapsing between their start and end events
3
Process Algebra (PA) In process algebra, concurrency cannot be expressed explicitly. Owing to the event character of the processes, simultaneous execution is not possible. Therefore, to describe parallel execution, we have to merge the respective begin and end events. We thereby view parallelism as interleaving. The corresponding operator is called merge operator and denoted by a double vertical bar: “||“. Signature and equations of PA are:
PA = (Σ PA , EPA )
Σ PA = Σ BPA ∪ { ||, L
EPA = EBPA ∪ {
}
PA1:
x || y = (x L y) + (y L x)
PA2:
a L x = a⋅ x
PA3:
(a ⋅ x) L y = a ⋅ (x || y)
PA4:
(x + y) L
z = (x L z) + (y L z)
} x, y and z are variables as in BPA. It should be noted that axioms containing the atomic action “a“ are only templates. There is an axiom for every atomic action where the “a“ of the template is replaced by a constant symbol of the signature. So, “a“ can be viewed as a generic atomic action. For example, “a“ and “b“ executed in parallel is written as a || b or in event form (ab ⋅ ae) || (bb ⋅ be). To depict concurrency graphically, we introduce process graphs with “and edges“ connected by an arc meaning “a“ and “b“ have to be executed both, but the corresponding begin and end events need not be executed in any particular order, except that ae follows ab and be follows bb:
a
b
4
Expanding the term into event form by successive application of the axioms of PA as term-rewriting rules (from left to right), we get: ab ⋅ ae ⋅ bb ⋅ be + ab ⋅ bb ⋅ be ⋅ ae + ab ⋅ bb ⋅ ae ⋅ be + bb ⋅ be ⋅ ab ⋅ ae + bb ⋅ ab ⋅ ae ⋅ be + bb ⋅ ab ⋅ be ⋅ ae
(1) (2) (2) (3) (2) (2)
Exchanging begin events (or end events) does not change the temporal semantics of the term, hence, there are four denotations for the concurrent execution. Note that all processes have the same duration. a
(1)
b
a (2)
b b
(3)
a
Resource-Constrained Process Algebra (RCPA) In this paragraph, we describe how resource constraints can be introduced into the framework presented so far. We assume a set of resources (e. g. machines) for which the processes compete: Process Machine
a M1
b M1
c M2
d M2
e M1
f M2
To express the resulting constraints graphically, disjunctive edges are used in the process graph connecting all processes competing for the same machine. Disjunctive edges are drawn as dotted lines according to Balas (1969):
b
c
a
f d
e
5
To represent disjunctive edges algebraically, we introduce the new operator “#“. For example, to denote the edge b-e, we write: b#e and read: “b“ not parallel “e“. But what does this expression mean in term of BPA ? Considering the event form (bb ⋅ be) # (eb ⋅ ee), “b“ and “e“ must not overlap, begin and end events cannot be “merged“. Consequently, the terms in parentheses can only be “merged“ (in the sense of the merge operator) as a whole. So, either the left expression has to be executed first and then the right expression, or vice versa: (bb ⋅ be) * (eb ⋅ ee) + (eb ⋅ ee) * (bb ⋅ be). Now, we have described the disjunctive edge itself, but not the constraints it imposes on process execution. We do the latter by introducing another operator, namely “&“. So, “x & y“ is read: “x“ constrained by “y“, or more precisely: The set of all alternative process sequences in “x“ is restricted to those alternatives containing a sub-sequence matching an alternative of “y“. A sub-sequence is a sequence obtained by deleting an arbitrary number (including zero) of atomic actions from the original sequence. Example for a sub-sequence: Given the main sequence a b c d, the following terms are valid sub-sequences (the list is not complete): a, c, b c, b d. The operator “&“ now deletes all alternatives not containing the right operand as a sub-sequence. For example, if we consider the following term: (b c a d + a d c e + b b) & (c d), the resulting expression is: (b c a d). This is the only sequence containing “c d“ (obtained by deleting “b“ and “a“). In “a d c e“ the order is wrong and “b b“ not even contains “c“ or “d“. With the new operators “#“ and “&“ and the axioms given, we can now formulate the RCPA (resource-constrained process algebra): 6
RCPA = (Σ RCPA , ERCPA )
Σ RCPA = Σ PA ∪ { & , #, δ
}
ERCPA = EPA ∪ { RC1: (a ⋅ x) & (a ⋅ r) = a ⋅ (x & r) RC2: (a ⋅ x) & a = a ⋅ x RC3: a& a = a RC4: (a ⋅ x) & (b ⋅ r) = a ⋅ (x & (b ⋅ r)) RC5: (a ⋅ x) & b = a ⋅ (x & b) RC6: a& b = δ RC7: a & (x ⋅ y) = δ RC8: (x + y) & r = (x& r) + (y& r) RC9: x & (r1 + r2) = (x& r1) + (x& r2) RC10: x + δ = x RC11: x ⋅ δ = δ RC12: δ ⋅ x = δ RC13: x # y = (x ⋅ y) + (y ⋅ x) } “a“ and “b“ denote different atomic actions. As usual, they are taken to be generic. “δ“ is a special atomic action that never terminates. It is called “deadlock“ or “inaction“. In RCPA, the graph shown above is represented as: [a ⋅ ( bc || de ) ⋅ f] & (b # e) & (c # d). If we apply the aforementioned axioms successively as term-rewriting rules, we get a BPA term that solely consists of “+“, “⋅“ and atomic actions without “δ“. This term contains all valid schedules. Some of the schedules are redundant because, as stated before, the exchange of adjacent begin events does not alter the temporal semantics of the term. In our example, the result is a term containing 38 alternatives which actually describe only 22 schedules (note that the term is in event form, so “AB“ means ab):
7
ab ab
ae ae
bb bb
be be
db
cb db
de
be
db
de
bb
bb
be
de
ab
ae
db
de
eb
ce de
be
de
be
de
be
ee
db eb
de ee cb
cb
ce eb
cb
ce eb
eb
ee cb
eb
ee cb
cb
ce eb
cb
ce eb
eb
ee cb
eb
ee cb
cb
ce eb
cb
ce eb
eb
ee cb
bb
be
eb cb ce ee eb ee ce eb ee ce cb ce ee cb ce ee eb ee ce eb ee ce cb ce ee cb ce ee eb ee ce eb ee ce cb ce ee cb
ee ce ee ce ee ce ee ee ce ee ce ee ce ce ee ce ee ce ee ee ce ee ce ee ce ce ee ce ee ce ee ee ce ee ce ee ce ce
fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
fe + fe + fe + fe + fe + fe + fe + fe + fe + fe + fe + fe + fe + fe + fe + fe + fe + fe + fe + fe + fe + fe + fe + fe + fe + fe + fe + fe + fe + fe + fe + fe + fe + fe + fe + fe + fe + fe
We have omitted parentheses to improve readability. In each line, only subsequences that differ from the preceding line are printed. So, the fourth line, for example, reads:
ab ae bb be db de eb cb ee ce fb fe
8
If we further assume that all processes have the same duration, we can eliminate another type of redundancy: alternatives that only differ in the position of adjacent end events. This leaves merely the 11 schedules printed here in order of descending length: M1
a
b
M2
M1
c
a
b
M2
M1 M2
M1
M1
a
a
M2
M1
a
M2
M1
a
M1 M2
M1
c
b
e
d
c
b
e
M2
f
(4)
(5)
b
e d
c
b
e c
e
d
c
(6) f
(7)
(8) c
b
f
f
d
d
a
c
e
d
a
f
c
b
M2
c
e
d
M2
M1
b
(3)
b
d
M2
(2) f
e
e
a
f
c
d
a
(1)
e d
a
d
b
M2
M1
e
f
(9) f
(10) f
(11) f
9
So far, our algebra is restricted to graphs/terms where constrained processes are not part of an alternative. Take, for example, the following graph:
a
b
c
Applying the axioms given to the corresponding term “( (a + b) || c ) & (b # c)“ yields: ( bc + cb), since the processes “a c“ and “c a“ neither contain sub-sequence “b c“ nor “c b“ and are hence eliminated. But process “a“ is not subject to the constraint and should therefore not be deleted. A possible workaround would be: a || c + [ (b || c) & (b # c) ]
Summary and Outlook In this paper, we presented a formal framework to express resource constraints on processes, namely RCPA. Here, competition for resources is expressed by operators “#“ and “&“ and resolved by a set of 13 axioms yielding the valid schedules. In addition, we used process graphs to visualize algebraic terms graphically. Here, resource constraints are denoted by disjunctive edges connecting the competing processes. The applicability of our theory is restricted to cases where disjunctive edges do not connect processes that are part of an alternative. The following work remains to be done: First of all, the restriction of disjunctive edges to non-alternative processes has to be eliminated. Secondly, we are currently investigating whether or not a non-interleaving algebra better suits as a basis for the RCPA. Third, we will introduce an optimization criterion into the theory (for example, shortest schedule) with the aim to develop an algebra to “calculate“ the value of this criterion and extract the optimal schedule from the set of alternatives. For this, time will have to be represented in the calculus. 10
The final result should be a schedule algebra for processes with arbitrary precedence graphs and resource constraints.
References J.C.M. Baeten & W.P. Weijland (1990): Process Algebra, Cambridge University Press, Cambridge. E. Balas (1969): Machine sequencing via disjunctive graphs: an implicit enumeration algorithm, Operations Research, 17, pp. 941-957. J.A. Bergstra & J.W. Klop (1982): Fixed point semantics in process algebras, report IW 206, Math. Centre, Amsterdam. C.A.R. Hoare (1978): Communicating sequential processes, Communications of the ACM, 21, pp. 666 - 677. R. Milner (1980): A calculus of communicating systems, LNCS 92, Springer, Berlin.
11