# we need to consider all these transitions simultaneously. We may therefore represent

## Full text

(1)

### HOW TO SCHEDULE IF YOU MUST*

SERGIU HARTt AND MICHA SHARIRTt

Abstract. Consider a finite set of processes, such that each one may use randomizations in its course of execution; these processes are running concurrently, under a fair interleaving schedule. We analyze the worst-case probability of termination, i.e., program convergence to a specified set of goal states. Several methods for computing this probability are presented, and characterizations of the special case where it is identically 1 are derived. Specializations of these characterizations to the case of deterministic and nondeter- ministic programs, and t.o the case of programs with finite state spaces, are also discussed.

Key words. concurrent probabilistic program, scheduler, fairness, program termination, Markov chains

fT.

fT

fT

ib

fT,

### We consider here general schedules

fT, with the sole restriction that they be fair,

### This model is discussed and justified more fully in [HSP]. We note that it coincides with the model assumed by Lehmann and Rabin in [LR], and also with that used by Dubins and Savage [DS] in their study of optimal gambling strategies (with the essential exception that they do not require fairness). It does differ, though, from various other models used in the literature (cf. [Rat], [Ra2], [RSt], [RS2]). The crucial distinction lies in the degree to which the imaginary scheduler can base its scheduling decisions on the outcome of random draws made by the processes, or, more generally, on their internal states. These more restrictive scheduling models usually correspond to situ- ations in which the execution time of a single step of a process is independent of its current state and of the outcome of the random draws it has made. Our model is more general, and allows for such dependence, thereby being a more realistic model for

* Received by the editors September 15, 1982, and in revised form August 1, 1984.

### t

School of Mathematical Sciences, Tel Aviv University, Ramat Aviv, 69978 Tel Aviv, Israel.

tThe work of this author was supported in part by the Bat-Sheva Fund at Tel Aviv University, and by the Office of Naval Research under grant NOOOI4-75-C-O571 at the Courant Institute.

991

L

(2)

1

### This paper is organized as follows: Section 2 presents the notations and terminology used in the paper, and begins the analysis of ({)by establishing some more elementary properties of this function. Section 3 develops the main technical tools for the analysis

1A nondeterministic program is one where each execution step of any of its processes may lead from a state i E I to several succeeding states, but where there is no probability distribution associated with these states; instead, each of these succeeding states must be considered as being potentially the sole successor of i. Such a program is said to terminate if every execution sequence terminat.es.

j

(3)

and characterizations of cp,and obtains cp as the limit of a certain transfinite sequence of functions. Section 4 gives further characterizations of cpoSection 5 treats the special case cp==1 (i.e. of almost-sure worst-case termination), and derives various characteriz- ations of this property. Section 6 specializes the preceding results to the case of deterministic and nondeterministic programs. The new characterization of termination of such programs is also given a direct proof. Section 7 treats the special case of probabilistic programs with finite state spaces. Some concluding remarks are presented in § 8.

LjEl P~j

~

### K, that

is, for each finite history hE H(i), O"(h) is the next process to perform an execution step, given that execution has proceeded so far through the states in h. The set of all schedules starting at i will be denoted by ~ (i).' To each such schedule 0" there corresponds an execution tree, defined inductively as follows. Each node of this tree is labelled by a pair (j, k) where j is the current execution state, and k the next process to be scheduled in this node. The root of the tree is labelled by (i, O"(i)). For each node v in the tree, let hE H(i) be the sequence of states along the path from the root

0"(

### h ); then v is labelled by (j, k), and its

sons are nodes labelled by (j', 0"(h, j')), (where (h, j') is the concatenation of j' to h) for j' E 1 such that pfj' > O.

Let H*(i) denote the set of all infinite execution histories starting at i, that is, H*(i) = {I} x J':ta (where 100

=

### Jt

1).

Each schedule 0" E ~ (i) induces a probability measure ILcr on the cylindrical 0"-field

### on H*(i), such that for each cylinder (i')1> i2, . . . , in), consisting of all histories whoseinitial n + 1 states are i, i1>. . . , in,

n-]

ILcr{(i, i1>. . . , in)} = IT P~~is+1' s=o

where io= i, ks = 0"(io, i], . . . , is). Expectation with respect to ILcrwill be denoted by EfT"

(4)

Let H*

### = U

iEl H*(i). Throughout the paper we will use the following notational convention: Elements of H*-which we call paths or histories-will be denoted by 7T; for each such 7Tand each n ~ 0, the (n + 1)th state along 7T will be denoted by in,

7T

7Tn

### ==

00, it. . . . , il1)' A path 7T is a fair path with respect to a given schedule U if each k E K appears infinitely often in the sequence {u( 7Tn)}~=O;the schedule U is a fair schedule if fLu {7T: 7T is fair}

{u E

U

c

7T,

### and 0 otherwise. The probability of reaching X under U is then simply Bu(Xx). The following standard observation, which also establishes the measurability of the extended Xx, will be quite useful in the sequel: For each n ~ 0

define a "truncated" extension X~) of Xx by putting X~)( 7T)

7T,

n-->oo 11

uE:I.F(f) ,

### Let N denote the set of nonnegative integers, and out N= N U{oo}. A stopping time Nis a mapping from H* into N

such that if N( 7T)

### = m then N( 7T')= m for each path

7T'

which coincides with 7T

### at all steps up to, and including m. In other words, N( 7T)may

depend only on io, it,

(J"

### In the sequel we will occasionally use the following standard decomposition of an infinite schedule (J"EL(i): Let N be a stopping time, fLu(N<oo) = 1; then (J"isequivalent to its initial portion T = ((J",N), followed by the collection of continuation schedules; that is, for each

7TE H*(i) (with N

### <

00), the continuation U7TNE L (iN) of if after the end state iN of T. Note in particular that (J"

### is fair if and only if each of the

continuations (J"7TNis fair.

(5)

Let a be a real function on 1. Then for each finite subschedule T

### = (CT,N)

E T( i), the expectation of a with respect to T is defined as

B,(a) = Eer(aON))'

For example, let CTE I 0), and define, for each n:> 0, Tn = (CT,n) E TO) (i.e., with the stopping time N=n). Then, as already noted, Eer(Xx) =limn-->eo ET,,(Xx). Note also that ETo(a) = a (i), and that ETI(a) = (pka )0), where k = CT(i).

Having introduced all the required terminology, we begin by establishing a few elementary properties of the function <po

PROPOSITION 2.1. (a) <p~ 0; <pIx==1.

(b) <p(i)=minkEK (pk<p)(i) for each iE1.

Proof (a) is trivial, since X is absorbing; note also that <p::::1.

(b) To show that <p(i)~(pk<p)(i) for kE K, iE I, use a schedule CTEIF(i) which starts by scheduling k at i, and then continues so as to approximate <pat each of the resulting states. For the converse inequality, take a sequence of schedules CTnin "2.F(i) such that Eern(Xx) converges to <p(i) and such that they all start by scheduling the same process k E K (since K is finite this is always possible); then it is easily seen that (pk<p)(i)~<p(i). More details can be found in [HS]. Q.E.D.

Extending standard notations in Markov chain theory, we say that a real function a on I is subharmonic if a ~ p\:r for each k E K. Similarly a will be called min-harmonic if a

### =

minkEK pka (note that each min-harmonic function is subharmonic).

In the special case where K contains a single process k, the function <pis harmonic (i.e., <p= pk<p). Moreover, it is well-known (cL [SPH] for example) that <pis the smallest nonnegative harmonic function which is 1 on X. This might lead us to conjecture that for a general (finite) K, <pis also the smallest nonnegative min-harmonic function which is 1 on X. This, however, is not true in general, as can be seen from the following simple example: Let 1= {O, 1}, X = {a}, and K = {1, 2}, with the nonzero transition probabilities p~,o

pi,l

### =

1. Obviously, any fair execution of this program brings it into X with certainty, so that <p==1, yet the function 1/1(0)

### = 1, 1/1(1)= 0 is a smaller

nonnegative min-harmonic function which is 1 on X. The reason for this phenomenon is that fairness is not directly connected to the min-harmonicity of <poIndeed, let us

1/1

### I/I(i) =

inf Eu(Xx),

UE~ (i) i E 1.

(i.e., infimum over all schedules, not necessarily fair). Then it can be shown that PROPOSITION

1/1

### is the smallest nonnegative min-harmonic function which is 1

on X.

Our next result is a strong form of a "zero-one law" for <p,which generalizes the zero-one law established in [HSP] for finite. state spaces.

THEOREM 2.3 (zero-one law). inCE! <pO) is either 0 or 1. Moreover, for each i E I and CTEIF(i) define a sequence {f,.}n~o offunctions on H*(i) by puttingf,.(1T) = <p(in), 1TE H*(i), n ~ O. Then {in} converges /-Ler-a.s. to Xx (extended to H*(i)).

Proof Let i E I and CTE IF( i) be given. The subharmonicity of <pimplies that the sequence {In} is a submartingale2 on H*(i). Since O-<fn -< 1 for each n ~ 0, it follows from the (sub )martingale convergence theorem that {In} converges /-Lu-a.s. to a limit fee. Put Tn = (CT,n), n~ O. Then

Eer(Xx) = ETn(Eu,," (Xx)):> ET"«p) = Eu(fn)

2i.e., for all n ~ 0, ECT(fn+ll'ITn)~fn, where 'lTnis any history of length n with J..L(T('ITn) > O.

(6)

(since each unn is fair). Letting n ~ 00, we obtain

E<T(Xx) ~ Eo-(/oo) ~ 1

### .

,uo-{ 1T: /00 ( 7T) = I}.

But for each 'lTEH(i), if X is ever reached along 'IT then/n('IT)=cp(in)=1 for all sufficiently large n, so that foo( 'IT)= 1. Thus

,uo-{ 'IT: /oo( 'IT) = 1} ~ /L<T{1T: X reached along 'IT}

### =

Eo-(Xx).

Therefore we must have equalities throughout; that is

Eo-(Xx) = Eo-(/oo) = ,uo-{ 'IT: /00 ( 1T), = 1}.

'IT.

1,

TET(i,k)

### (Qa )(i) = max (Q~a)(i).

kEK

Let R be any of the operators Qk or Q; then plainly R is monotone (Le., at ~ a2

implies Ra)::: Raz), RO

### = 0, and R1 = 1. The following lemma gives two characteriz-

ations of the operators Qk, one of which is constructive while the other is not.

LEMMA 3.1. Let a be a bounded real function on 1. For each k E K, Qka is the largest subharmonic function which does not exceed pka (i.'e., (1) Qka ~ pka, (2) Qka is subharmonic, and (3) if f3 ~ pka is subharmonic, then f3 ::::Qka). Furthermore, Qka

(7)

is the limit. (or infimum) of the following nonincreasing sequence of functions:

/31(i)

/3n+1(i) = min

### {

/3n(i), min (pI/3n)( i)

IEK i E I, n2:1.

### /3n(i) = inf Er(a),

TE Tn (i,k)

where Tn(i, k) consists of those subschedules in T( i, k) which stop after at most n steps. Q.E.D.

LEMMA 3.2. For each subharmonic function a and each k E K we have a~Qka~pka.

Proof. By Lemma 3.1, Qka is the 1<irgest sub harmonic function which is <.pka.

Since a itself is subharmonic w~ have a ~ pka, so that a <.

'Ya

'Y~,

E

k

'Yo

'Yo= Xx,

b<a

'Ya

### = max 'Y~ for each ordinal a.

kEK

,j'

The functions 'Y~and 'Ya are called the cp-iterates of order a of the program (the reason for this terminology will be apparent at the end of this section).

Since X is absorbing, QkXx ~ Xx, thus 'Y~::> 'Y~ for each k E K, hence 'Y1::>'Yo. Also,

### by definition, 'Y~~ 'Y~for each pair of ordinals a> b > O. Thus, for each k E K the

transfinite sequence {'Y~}a~O is nondecreasing, and so is the sequence {'Ya}a~O' From this it follows that 'Y~+1

### =

Qk'Ya for each ordinal a, and that 'Ya= SUPb<a'Yb for limit

### Since the transfinite sequence {'Ya}a~Ois nondecreasing, and each of its elements is obviously bounded between 0 and 1, this sequence must converge to a limit function 'Y,and there must exist an ordinal c such that'Yc = 'Y. (Indeed, for each i E I thetransfinite sequence {{'a(i)} is a nondecreasing and bounded sequence of real numbers, and so must attain its supremum at some ordinal Ci; the required ordinal c is simply

SUPiEl Ci') Obviously Q'Y

Q'Yc

'Yc+l

### =

'Yc= 'Y.Moreover, using standard fixpoint argu-

,.'","

(8)

'Yn

I'n

n

### This interpretation can be extended to higher-order ordinals. Specifically, for each ordinal a we define a collection of games f a(i), for each i E I, in the following transfinite

inductive manner:

{ 'Ya}a;;;;O,

B

T E

b( i)..

### ours.)

(9)

To illustrate the possible discontinuity of Q (and hence the need for higher ordinals), consider the following example (in which both processes involved are actually deterministic) .

Example 1. Let K = {I, 2}, and let I = II U I2, where II = N x {I}, 12 = N x{2}, and X = {CO,I)}. The nonzero transition probabilities are

pI(n,I),(n-l,l)

p2(n,I),(n,1)

, n>O,

pI(n,2),(n+l,2)

- p2(n,2),(n,1)

### - 1 - , n:>O.

These transitions are displayed in the following diagram:

1,:

I, :

2 2 2

### 'Yn(i,l)={O, 1,

i:> n,

i < n, iEN.

By definition of 1'", we thus have

'Y",(i, 1) = 1, iEN.

### On the other hand, 'Yn(i,2)=0 for each i, nEN (to obtain (Q2Yn)(i,2), schedule process 1 sufficiently many!imes so as to reach a state (j,2)with j 2: n, and then schedule process 2). Thus

'Y",(i, 2) = 0, iEN.

But 1'",+1= Q'Y",

### >

y",. Indeed, for each (i, 2) E 12 we have

j:>

'"

(10)

### (2) One can easily obtain along similar lines examples where higher and higher ordinals are needed to attain convergence.

(3) If we take in Example 1, pko,(o,O =! (instead of 1) and pkl)(0,2)

### =! (instead of 0), it can be verified that the first ordinal c where Yc= cP==1 is c = CU2.

The main purpose of this section is to prove that Y

cpo

### The proof of this assertion

is quite involved and will be split into proving both inequalities Y ~ cp and Y;;:;cpoIt consists of the following sequence of .lemmata. .

### E(T(Xx) = Er[E(T"(Xx)](because N + 1 is a stopping time)

N+l

;;:;Er[CP(iN+l)] (because (J"7TN+1E 1,F(iN+l))

;;:;(Qkcp)(i) (by definition of Qk).

Since this holds for each (J"E !.F(i), we have cp(i)?; (Qkcp)( i). Q.E.D.

PROPOSITION 3.5. cp

Qcp

### =

QKcp, for each k E K.

Proof By the preceding lemma, Qcp = maXkeK Qkcp ~ cp: On the other hand, for each k E K, Qkcp?; cp by Lemma 3.2, since cp is subharmonic by Proposition 2.1(b). Q.E.D.

LEMMA 3.6. Y ~ cpo

cp;;:; Xx

b

a;

QkYb ~ Qkcp

Ya ~. cpoThus Y

### = Yc~ cpo Q.E.D.

LEMMA 3.7. cp~ y.

### Proof Note that, since Y =

maXkeK Qky, we have

### (*)

y(i)?; re TO,k)inf Er( y), i Eo/,

Tn

### starting at i (initially,

TO is "empty"). The (n + l)th layer of (J"is defined by appending to Tn

### y(j) ;;:;Ep/ y) ~

8n

(such a subschedule exists by (*)). Repeating this process inductively, we obtain the required (infinite) schedule (J",which is fair by our choice of the sequence {kn}ni5;l'

Let {N"},,i5;o be the increasing sequence of stopping times defined by our construc- tion; namely-the nth layer (i.e., T,J ends at N" (in particular No ==0). For each n?; 0 define the function

gl1(7T)=Y(7TNJ, 7T E H*(i) ;

(11)

in particular, go

### =

'YO). By the choice of the subschedules Pj

### (**)

gn ~ Eu(gn+111TNJ - En+1> n>O.

Hence, the sequence of functions {g~}n~O given by

n

### "

g n = gn - L. Em,

m=1

n;?:O

forms a supermartingale, which is bounded between 1 and -E. Hence it converges almost surely to a limit g:x" so that {gn} converges almost surely to the function

ee

gee

g:x,+

### I

Em = g:x,+ E.

m=1

Note that 'Ylx ==1; thus, if X is reached along 1T,then gee(1T)= 1, because for all sufficiently large n we will have gn (1T) = 1. Hence, by (**),

'Y(i) = gb~ Eu(g:x,) = Eu(gee) - e

~ J.Lu(gee= 1) - e

;?:J.Lu(X is reached) - E

### = Eu(Xx)

- e::: <p(i) - E.

Since E was arbitrary, the proof is complete. Q.E.D.

Thus we have shown THEOREM 3.8. <p

'Y.

### P

I _1

. i,i-1 -3, pI ' +1 = -32

1,1 , i;?:l,

pt-I = 1, i;?:1.

.)

'Yn-I l - 0,

O<i<n,

i> n,

, -,y.

### Comparison with the iterates 1n and their limit 1", for the case in which only process1 is activated shows that /"" = 1", but /'n > 1n for each finite n. Thus the fair interleaving of process 2 with process 1 increases the probability of convergence under any finite number of fairness constraints, but does not affect the overall (worst-case) convergence probability.

4. Characterizations of 'P. This section contains the main results of the paper,

### deriving various properties of this function. Obviously, the most important such

(12)

property is whether cp==1 (i.e., whether the program terminates almost surely from any initial state). Relaxation of the characterizations of cp given here will enable us to derive necessary and sufficient conditions for program termination, and these conditions are presented in § 5.

THEOREM 4.1. (a) cp is the smallest fixpoint of the equation cp

Qcp

which

cp

cp

Qcp

cp ~ Xx.

Qt/J.

### Then

t/JE;;'Yo, thus t/J

'Yt,

### and by transfinite

induction t/J ~ 'Ya

t/J ~ 'Y

cpo

t/J

Qkt/J

### for

all k E K implies t/J

.

a itself. .

a

### Remark. In carrying out the calculationsof the. procedure just outlined, it may sometimes be more convenient to employ the "I-complement" version of Theorem

4.2; that is, instead of computing cp we compute the function t/J==

- cp,

t/J(i)

### =

min supEA t/J)

keK TeT(i.k)

(13)

or, alternatively, is the largest function f3 s; 1 having property (B), defined as (B.l) f3lx ==0;

(B.2) {3 is superharmonic, i.e., {3:::::;pkf3 for each k E K;

(B.3) for each k E K, the only superharmonic function between pk{3 and {3 is f3 itself.

(Again, we can replace (B.2) by (B.2'), namely require that f3 be max-harmonic, that is f3 = maxkE~ pkf3.)

The usefulness of this complementation lies in the fact that property (B) is positively homogeneous (i.e., f3 satisfies (B) implies "-.8, satisfies (B) for every A> 0, where ("-.8)(i)=="- '/30)); note that (A) was not such (due to (A.1)). For example, we 0btain

COROLLARY 4.4.cp ==1

--

.8

### "- ==SUPiEI.8(i) < co and is positive. Then

(1/ "-)f3 also satisfies (B) and is ~1. Q.E.D.

We can also give now a second short proof of the Zero-One Law for cp; namely, that inf;EI cpO) is either 0 or 1 (see Theorem 2.3; however, the original proof is more

### elementary).

,

Second proof of the zero-one law (Theorem 2.3). Let I/J

cp and put

"-

### P

l.'i2,it= P'li2.i4= P2i2,i1= P2i2,i4= 2,I

P}3,i3 = P73,i2 = 1,

P}4,i4= Pt,i3 = 1.

al ~

<1

1

a2 =2al 2a4,

,

"-'

a3

a2,

a4 ~ a3'

### pIa = (1,

!al +!a4, a3, a4)

(14)

pi p2

11 12 13 14 Is 16 X i 1 i2 i3 i4 IS i6 X

II I 1 1 1

'2 '2 '2 '2

12 1 1 1 1

'2 '2 2: 2:

13 1 I 1 1

:2 2: 2: '2

14 1 1 1 1

'2 '2 '2 '2

Is 1 1

2: :2 1

16 1 1

'2 '2 1

is also subharmonic. Hence we must have a :;:::

### pi a, i.e.,

0'1:;:::1; a2:;::: '2alI

'2a4:;:::1 1

### +

1

'2 '2a4'

Similarly, for k:;:::2 we have

p2a:;::: (at, ~al +~a4' a2, a3), which is also seen to be subharmonic. H~nce a:;:::p2a, i.e.,

a2 :;:::a3, a3 :;:::a4'

### Thus we have

al :;::: a2:;::: a3:;::: a4:;:::

### Example 4. This example is also taken from CHSP], and arises in the analysis of

another synchronization protocol. Here K:;::: {I, 2}, I:;:::X U {ib

### .. .

, i6}, and the transi-

### tion probability matrices are

It is straightforward to check that a general subharmonic function a:;:::(ab . . . , a6) which is 1 on X must satisfy

al :;::: a2:;:::

:;:::a6

### ~ 1.

It now follows that (A.3) holds for each such function a, because any function constant on I - X and lying between a and pi a (resp. p2a) must coincide with a

'P,

### which is the

smallest nonnegative such function, is Xx. '

Example 5 ("The Two Combs"). I.::et K:;::: {1, 2}, I:;:::X

### U Z (where Z denotes the

set of signed integers); the nonzero transition probabilities are

P:"n+l :;:::

Pm P~,n-I :;:::qm

P~,x :;:::p~ :;:::1

### - p",

p~,x :;:::q~ :;:::1 - qn,

nEZ.

To avoid degeneracy, we assume that 0 < Pnqn+l< 1 for each n E Z. Denote, for nEZ,

00 n

QnF TI qmo

Pn:;::: TI Pm,

m=n ,"=-00

Denote by (Cl-) the condition

(C+) TI Pn

11>0

### and lim sup qn = 1,

n~oo

and by (C-) the condition

(C-) TI q"

11<0

### and

liill sup Pn:;:::

### 1.

n-+-oo

(15)

-- -

PROPOSITION 4.5. (a) If neither (C+) nor (C-) hold, then 'p ==1.

(b) If (C+) holds but (C-) does not hold, then 'Pn= 1 - Pm n E 7L (c) If (C-) holds but (C+) does not hold, then 'Pn= 1 - Qm n E 7L

### (d) If both (C+) and (C-) hold, then 'Pn= 1-max {Pm Qn}, n

E71..

Proof It will be more convenient to work in "1-complement" mode, calculating

IjI

### proceeds through the following steps (for details, see [HS]).

(1) If IjIn= 0 for some n E 71.,then I/J==O.

(2) Put IjIl= pllj1, 1/J2= p2ifJ; if I/J==0 then it is impossible to have for some nElL., 1jI~= IjIn and 1jI~+1= I/Jn+l'

(3) IjIn> 1jI~~ I/Jm> 1jI;" for each m -< n, and IjIn

### >

I/J~~ IjIm> 1jI;" for each m ~ n.

/

### (a)

1f/=ljIl=1jI2==0;

(b) If/n = 1jI~

### >

If/~ for each n ElL.;

If/n

1jI~

### >

I/J~for each 11E 71.;

(d) there exists no E 71.such that IjIn= If/~

### >

If/~ for each n> no, and If/n= I/J~< If/~

### for each n < no.

(5) Suppose If/> O. If, for some no E 71.,If/n= If/~

TI n> noPn

### >

O.

Similarly, if IjIn

### =

If/~ for each n < no, then TIn<no qn > O.

(6) In particular, if TIn>oPn = TIn<o qn = 0, then If/ ==O.

(7) Suppose IjI> O. If, for some no E 71., IjIn

1jI~

### for each n> no, then

lim SUPn~C()Pnqn+l = 1. Similarly, if If/n = I/J~ foreach n < no, then lim SUPn~-C() Pnqn+l = 1.

0/

o/n

o/~

0/

0/2

0/

I/J~

### (11) Finally, if both (C+) and (C-) hold, then case (d) mus( occur. Q.E.D.

5. Verification of program termination. The results developed in the two preceding

'P ==

### Proof See Corollary 4.3.

PROPOSITION 5.2. 'P. 1

and only

### if

there exist an ordinal c and transfinite sequences

a;:;;c,

E

### (2) 5~ is subharmonic for each a-~ c and each k E K;

(3) 5a ~ maxkEK 5~, a -<

### c;

(4) 5~+1-<pk5a, kEK, a<c;

(5) 5~ ~ SUPb<a 8~, for limit ordinals a, and k E K;

(6) infiEI5c(i»0.

,.~.

(16)

### lim sup (QxEJ(i)=O.

n-->co iEE"

m;;;;;}

In other words, let n ~ 1, i E En' m ~ 1 and k E K be given. Then there exists a subschedule in T( i, k) which reaches Em with probability tending to 1 uniformly as 11-7 co. That is, without losing too much probability, we can'reach any of the sets Em from any state in Ell after scheduling any required process.

THEOREM 5.3. cp==1

### if and only if I - X does not contain any K-ergodic chain.

Before proving this theorem, we need two lemmata.

### LEMMA5.4. Let 0> 0, and define D = {i

E I: cp(i) ~ 8}. Then cp~ QXD'

Proof Let i E I, k E K, and 0- E I-F( i). For each n ~ 1 define a stopping time Nn on H"'(i) so that Nn(1T) is the. nth time k has been scheduled along 1T; note that {NII}II;;;;;!is an increasing sequence of fLu-a.s. finite stopping times, whose limit is +co.

For each n ~ 1 the subschedule 7"n

E

### T(i, k), so that

(QkXD)(i) ~ ET,,(XD) = fLO"{cp(iNJs 5}.

### Consider the sequence of functions

{fm}m;;;;;u, defined by fm(1T)=cp(im),msO, 1TE

### H*(i). By Theorem 2.3 {fm} converges a.s. to a limit foo, such that foo(1T) is 1 if X isreached, and is otherwise O. Therefore we also have cp(iNJ-:fco a.s. as n-7co, so that

fLO"{fco~ o}~ Jim fLO"{cp(iNJ ~ 5}~ (QkXD)(i).

,,-->00

Since 0> 0, we have fco( 1T)~ 0 if and only if foo( 1T)

### = 1, or, alternatively, if and only

if X is reached along 1T.Thus .

E(T(Xx) :;=fL(T{fco ~ o} ~ (QkXD)( i),

### LEMMA5.5. Let {G,J,,;;;;;!be a nondecreasing sequence of subsets of I, all of whichcontain X, and let {E,,},,;;;;;!be a sequence of positive. numbers converging to O.Suppose that

Qxo", (i) ~ E"

for each m, n ~ 1 and each i E G~. Then

cp~ sup QXo",.

m

Proof Put {3==sUPm QXo",. The above assumption concerning {Gn} can be restated as

Qxo", ~ E,,' Xo~+ 1.

Xo"

en

### + (1- en)Xo",

(17)

for each m, n ~ 1. This implies

t32En+(1-En)XG,

### .

M n ~ 1, and thus

Qt3 2 Q(En + (1- En)XGJ, n:> 1.

13

### =

Qt3 (see Lemmata 3.1 and 3.2), implying 'P 2 13

{En}n~l

'",

I

'P

### < 1. It is easily verified that in case (b) the chain E~ =

{i: i ~ n}, n:> 1, is

O}

chain En

### = E,

n ~ 1). There are two problems, however, with this approach, which

.

PROPOSITION

### 5.6. There exists a nondecreasing sequence {Dn}~=l of subsets of I

such that

(1) 'PIDc==0, where D = U~=l Dn, (2) 'P = limn~oo QXDM'

Proof Put Dn = {i: 'PO) ~ 1/ n}. Q.E.D.

Note that in the case 'P==1 we can take Dn ==1 for all n. Moreover, COROLLARY 5.7. If I is a finite set, then there exists DeI such that (1) 'PIDc==0,

(2) 'P = QXD'

(18)

### the same behavior can be achieved by introducing a new shared variable v which k1sets to some value in A prior to making the choice, and by introducing another process k2 whose only action is to iterate v over the set A. k1 then makes its choice deterministi-cally, depending on the current value of v. Thus the nondeterminism is now transferred to the scheduler-the final choice depends on how many times k2 has been scheduled in between.) Thus, by specializing the various equivalent criteria for program termina- tiondeveloped so far in this paper to the deterministic case, we can obtain similar criteria for the termination of deterministic (or nondeterministic) concurrent programs.

I As it turns out, the criterion obtained in this way from the characterization of <pas

a;;;;O,

E

### K, and {Ga} a;;;;Oof subsets of I having

the following properties:

(1) Go

E

### K;

(2) there are no transitions from states in

### G~

to states outside G~, for each ordinal a and each k E K ;

(3) Ga = U kEK G~, for each ordinal" a;

(4) for each k E K and each ordinal a, all k-transitions frqm states in G~+l are to states in Gu;

(5) G~ = U I,<a G~, for each limit ordinal and each k E K;

(6) there exists an ordinal c such that Gc

### =

1. .

These conditions, however, are merely a rephrasing of the characterization for termination of "just" programs given by Lehmann, Pnueli and Stavi in [LPS]. To see this, define a function p from I to the ordinals 'by

pO) = min {a: i E Ga}, i E I,

and a function h: I ~ K which maps each i E Gp(i) to some k E K such that i E G;(i)' Then it is easily checked that these functions satisfy the conditions in [LPS] for just termination, i.e.: the "ranking" map p never increases during execution; activating process h( i) at state i always strictly decreases the value of p; and h remains unchanged

Updating...