81 c tang nl ~~3 i.. - dtic.milchih-sung tang f49620-80-c-oo0l 9. performing organization name and...

27
£AII 504 MARYLAND UNIV COLLEGE PARK DEPTOF COMPUTER SCIEN4CE F/6 9/2 EXPRESSING THE FORMAL SEMANTICS OF CSP AND CF OR ADA TASKING VI-ETC(U) NOV 81 C TANG F49620-80-C-0001 UNCLASSIFIED AFOSR-TR-82-0076 NL I.. :, ~~3 llllllllT

Upload: vanthu

Post on 28-May-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

£AII 504 MARYLAND UNIV COLLEGE PARK DEPT OF COMPUTER SCIEN4CE F/6 9/2EXPRESSING THE FORMAL SEMANTICS OF CSP AND CF OR ADA TASKING VI-ETC(U)NOV 81 C TANG F49620-80-C-0001

UNCLASSIFIED AFOSR-TR-82-0076 NL

I..

: , ~~3 llllllllT

11 11 ~ 112 jj~j123.6

11110 11111=o

111111-25111.8

MICROCOPY RESOLUTION TEST CHART

sSECURITY CLASSIFICATION OF THIS PAGE (N1nnDt ... reI

REPORT DOCUMENTATrION PAGE -I

1 . R 3 2 - 2 GOVT ACCESSION NO 3. RECIPIENT'S CATALO Nj ER

TITLE (and Subtitle) 5. TYPE OF REPORT 0 EiDCyE

EXPRESSING THE FORMAL SEMANTICS OF CSP AND OP OR TECHNICALADA TASKING WITH THE TEMPORAL LOGIC LANGUAGE XYZ/E ______________

6. PERFORMING 01G. REPORT NUMBER

7. AUTHOR(s) 8. CONTRACT OR GRANT NUMBER(s)

q~Chih-sung Tang F49620-80-C-OO0l

9. PERFORMING ORGANIZATION NAME AND ADDRESS 10. PROGRAM ELEMENT. PROJ'LCT. TASK

S.~Computer Science Department AE OKUI UBR

University of Maryland 61102F; 2304/A2

1t. CONTROLLING OFFICE NAME AND ADDRESS 12. REPORT DATE

Directorate of Mathematical & Information Sciences NOV 81Air Force Office of Scientific Research 13. NUMBER OF PAGESBollin AFB DC 20332 18NI.MONITOR ING AGENCY NAME & ADDRESS(ii different fromi Controllmng Office) I5. SECURITY CLASS. (of this repare)

UNCLASSIFIED15a. OECLASSIFICATION.DOWNG$IAOING

16. DISTRIB3UTION STATEMENT (of this Report)

Approved for public release; distribution unlimited.

17. DISTRIBUTION STATEMENT (of the abstract entered in Block 20, if different from, Report)

16. SLPPLEMENTARY NOTES I-

IS. KEY WORDS (Continue on reverse side It necessary an~d Identify by block number) .

A Co y av ilabe to DTIC does 1201

20. ABSTRACT (Continue an reverse side Hi necessary and identify by block number) " eprllgclnug sitoue.I eni ul eil exd~~O

LU as well as a programming language. It h,,ts two forms: the internal form is in

lower level, but there are several abbreviation rules which can transform aprogram in internal form into a higkter' ltevel external' form and vice versa. _A__01

D FORM 14731- EDITION OF I NOV 6S IS OBSOLETE UCASFE

SECURITY CLASSIFIC)%TION OF: THIS PAGE (1R34en Dw. F,a-i ,I

DISCLAIMER NOTICE

THIS DOCUMENT IS BEST QUALITYPRACTICABLE. THE COPY FURNISHEDTO DTIC CONTAINED A SIGNIFICANTNUMBER OF PAGES WHICH DO NOTREPRODUCE LEGIBLY.

.. AOSR-TR- ~2-007 6 j c, -

EXPRSSING THE FG132ALSEATC

01OF CSP AND 'P 02, ADAISK7-CWITH TiE TEMPORAL LCGIC I-ANCUzAG- XYZE

Chih-sung Tang

Ccmputer Science Deparz.-2antU:niversity of Mlarylanf.Co11e,,e ?a-rk, KD _?G74-

*Thist work was suoported i.t pairt b the Air F.;rce O f ice cfScierntific Research Cornrac. AN -F4962C-8O-COOGJ L, to th University. f

4ar~hd. o~.'uersupport pro-\'Lied i- .- rt ')y C-., Co'.nt::r SC~.

Cence:: -i thc 'Uz.,iv,:rsity of flIaryland.

2 03Approvedfor03distributiOluaiimitod, ,

Er ratum

P-7 bottom up line 5~ changed into

P.17 l.ine 10 changed i:--to

h-Cscrn)-(v): 4v-(sem)-(v)-(lO)= : => O4vv-(sern)-(v)- 10) F ^T,end;"

P.17 line 17 changed intoTh-(sern)-(p): #v-(sern)-(p)-(1)= T => O#v-(seir)-(p)-(l)= F ^ tend;

h "- (semn)-(P): *v-(sem)-(p)-(1O)= T => O~v-(sem)-(p)-(1O)= F -t~end;"

PP. 9-12 The se-natic transfor-mations of:"> ought tCa be changed according

r-o the follcwing pattern:8,3(A-> BE -)( ) ~ A>B>C [~A (B) ;~

So, the programs in Example 2, 3 must be changed accordingly.

..............................I23C

V3; ie'

APPEDIXSome Basic Features of rrz/E

(1) In X-'-7/t, each naze is divided into three par:(t-pe symbol <root> OrC=>.

Tho typp symbol is al"iay omitted; the :oot is an ident 'ier and the indcex is a a- un

of nodes connect~ed by hyphens. A node can be an identifier or an nteg-r or an intc er

grouped by braess..E.g. IAbc-(3)-ga is an n.me in which I is tht type, abc is the roor

and the rest is the index.. Related to the concept of name, a name schema is an axpre-

ssion whose value is a name. The form of a name schema differs from a name in that in

the former an integral -arirblz can occur within the braces of a node, e.g.

* Iahc-( Kabc)-ag2 is a nam= szhaia, hare #Kabc is a cointer correauponding to bc.

(2) Fcr a nama v,7 iz a -eneral .ariablc. It re[z-scnts its valat at pre-r. U= t.

a v ra.n sants the value of this variable at next tim i.e. t+1. o"#v re-rzcenta tle

value at time t~k. To make use of this convention, we can represent assignment v -v+l

as ao#-#vl;ad also goto p can be expreesed as o#lb-p, here +1b is a special general

vz-iable uzad to Lndicate ths current control i1 bels. In this way, both assignme.n and

goto becoma equ .ti . We call the eqtaticn with 41ib in it a 2:) eq=ation. cib-p can

be Abbre-eiatad "u "p and Jbp as p:

(3) We naa the lb equa.tions or their a .v.atc forms to enpress not =n7 -he cotrV[

flc,, of statrsmznts i.e. compound statement, case statement and loop, cut also various

data structures,i.s. record, type union and arrly, for both are correspondent to

sequencing, branching ax itaratian respectively.

(4) Just az assi ument is the basic element in statements, so I (integer), C (charac-

ter string) and B (boclean) are basic tit-znts iza data type. They =- ba usId both as

type symbols and as allocaticu2l for=Ims. Ls latter are introduced in order to abb-

reviate the forir. Besides, there is another alocatioral foriJla or type which is

used to represent poiLnter, i.e. PT here T is the type of the object to be referenced.

(5) A program i. alirays written ,with a special f-rz. which is a series of 4-o calJd

cmid itiorJ2l emaLznts sr.parated by ;. A conditiial element is :f the forz .- >B 'wi ch

ans tkh' if A then B elie false. A program is always qatii &brach -d

a subseauexice af canditionzaj elements can also be grouped in that -w~j 'he

follouring is ax'. eza~rple of integral sqare root:

'%oL #lb-In I/. Iolb-Tk '

* ~%v[ #2.b-Ik i)IAo#lb-Ilp;

- %a r i#21 a o4-nL-OAO41D-1Ao+1J2;

#J2b-12A#Ip>#Im - o~lb.14;

4lb-14 - #IkA c42lstopJ

This is the internal ±or-m of a pogram.t It ',)l~ craer level. LIn ordzr to transform

* it into a hi#er level erttornal form, som abbrevizti, i . se ae g1f, *g. a Coto

* stat-=snt, leadIing to next izbel an always; oe omitted, eto. ('111). The extax'nal form

of above eannl-a is-

,%? oo4pkZk+3#k#k+V412

(6) Iz order to use XIZ/E to axpreS thae formal sem.~.tia- of othar aea

metaLaguage is introduced in idiich Psasmni r~p:ing, At zaps each construct

of the object language into a string of entities in UZ/E; "':so-.replacing sym Dol;

'f- them.lei..e~e is u~sed to distinguiish differenxt caes; a--t begins wi'is

t.o indicate the beginning soction of the string~. The amtuitivt mean=nq ef all chOse

syoboj.isw$in nstal-.guage are obv~.Ous-

iiz

Expressn~ng The Formal. Semantics c--, CSP and VCP or fiDA TaskingWith nhe T11emporaJ. Logic Langaiage =1/E

Chih-Laung Tang

in (TI), a teirporal logic langu& e =122 Is introduced. It is a tz::poral

logic system as well as a'.pogaing langtae. It has two forms- thc int.:rrnal

*fan is in :lo-er level, ';there are several abbreviation rnilez wich

can trarsform a prog.-an in ntcrnal fo- into a :iigher level e~zterr'al form and

,r-ce var3a. L-. th-e AP2 of this pari.r, sne ':s ic features of this .Lgare

area illustz-2ted.

One of tha maj-or applications of XYZ /Z is to n-se it as a. mearx t, ezxpess

the foral ee==ntics of other prograrnfi systes inr-1uding, cornentloa3. hieh-r

level lanzuagas .For it iJS a log-ic cysts r-, C-wn senrntics is z..5 csily defin-e~.

den-ttio va a:y 1L=-i ayster-; -wbilc i ,s Llso l o~ evel .=n-ug~

the s~~ s -if 3tner prcgranai2n4 cani bt ccnveiently ==pped into .

it saems tn n- that this approach is rzr natur=aJ than denotatixal. smantie-s

aznd also more elcgant than operational semaitics. This paper may bAcL:- to ~z

that the more comp.icateLi4; the problem, the. morz obvious .19 tha adrnntaVa

of this appc-acA2. Besides, this approa is very cloze to ths real compiler.

IX'Z / in its criE.r=a. verrsion (T)Contains a layer to c.zscri'be P,:.tri net.* It

car, expreas those concurrent or nonisterminate algorithms such as prcduic r-

ccnrx-or p2i Iblem or five philosophers problum qiL neatly. But this auzlor

finds that Petri net may not be a suitable maax. to express such concurrent

COwniructs :z Hioare's CSP, )4ao-.Yeh's CP or ADA Tasking. ad pikoer iill show

:,a to express then with Xr Is. 'To imj Lurprise, the result ceems vei-y sat~ co~

..ov: to +--are timn o r ~r 3 f a d s t r L~22~r is knrc'r&in f

D r o L) r, tais paper, a new frr>: : i3~moz:

whih ser .ablo siaxvi t!-J 7he r, vat,

.. e TZ~Y, c nt:> n c

f ,r -uc1es t -- : -

* r henameo aibe n aesns ko:be f ro z:2; ao~

0 h cr:i no S 12 0CM icazaon ic-, Css I e.

or b -s f hc I - Z hv i s t ha t e ven r:ooo cov Z7as

ren .. , r:.vate time syt'softe nrcoos c

c n - --- m ~ -**- -* - c----. '., Ok.*

c. r. -t tm c ra c Ca c . ri hs an - nex

ty 3y c c cDc 7n

r.al ec,3sst (0. T eans of thes c co-

it --'z exzre-s Zuch k1-lnd of cSc~lS a .sa n~- x--I

va tue 3 f va r4s V ~i j(cooigt jszn sse)i

n r z--c nt z inc v ziuo o f v ari a bl1e u La a c c r f t o Ps tic I "T, S ZoM

.'r.Linot anyun o fri Pi P -k cIn~ ot-her'S tin 'st1 a

~~nand .enao~o mn hes,. proocsstosse

2

F ~ Fo.-a1 Semaantics of Hoare's BCSP

(W CS? =nd guadzca. rind.

concarc ;ro~r~r: P PII/ .~//1-n Jharei: Pi Si, i-i,...,n, Pi process, Si statement.

state zat ncludes:

(all input co==A: Pzl?x (in Si)

(b) oatnut co~xnd: P)-Ly (in Sj)

(a) guade osd: BI--?SI B2--,S22 Bk

(ci) rapetiticn: I[i~~ 32.oS2 5 .. Bk4.513

(e) skip -nd a.z3ig2an

* (f) atatexzrnts sequence: Sii;.*.;Si1

boolean e cressionE includes:

Wd) boo1zan seq,=cce: BiI;Bi2.;...;Bizm

The exact axpli~aticn of these constructs,iee (BI),AI).

(2) Presupposition before trm2naforzmation.

Ci) Assumdxg th:at :.1r 4y rAt of aach stateaent t-;erm li already bae r a 1ana2.

azA 4 th ±e rigat of cach procass Ti. there i2 a 19 endi. C szequently, Z.'zr

eaah lboolzrn exprecsion or stzataeava, &. labol to its nCL;:-ast right oan aJ.rys

be found- Let nextibe th3 nearest labelrg. to 'Di or Si, it can be deter-.

mined in fcifl.vdng wa7r:

(a) 9,i.Ci )b;..;.;.;bkp 1:3 SII is the next i -or bi.

(b) ~. n 2:i;.;I~ ;...):Sn, ti is the nexti for S.,

Cc) if S is the WLat state~nt in zn Si (14-4,,) in foil,-wing Stalc e'2l

tan I is the next1k for this S.

3

(ii) To eazL process Pi in LP1//P2///.../PNj private control -iiable !,lbior its abbreviated f orm T~ i is assigneo. and in addition. a co~non cntrol

vari.able #1b or t is also availabla.

(ii.) To each ingat ccmand Pjylxij in Si (or Pi), a bcoleaL - is assigned;

Teach output command Pi~yji in Sj (or Pj), a boolean #Zsj-i is asgned.

Let Pu"1-vu represent. either PJ2xij or ?i~yji.

(3) Tranaformation from CSP to IYZ/E.

(a.) Each statewf-t asqtsnce is traformed into a coapound, zta-uent, i 3.

(ii) Each boclean sequence hil; ... :bk is transformn d iznto a ccn i1z~,ti~n, i.e.

Sl Fb) if there is no input,-output coaxaid !i:n l..,-k

5(PuwLIX) if PuLRr ccurs in bl,...,bk.

(iii) Mhe concurrent program is tra.isforied as follows:

A.P~ p4:Si l

(iv) '114-a Tarded co~n2'zL &.- trsnnfornsd in follrwrig w-g (zi I"-;i)-

r.=:S) opn: i (BI)) 2.:j()A i et

fl2-,(BI)A...A-R(Bk)-t next

next:

Coe t- in the original def:iition of conditionaal elemente in (TI"),

tkm conditions i-ith one coim~on Label n=ust be :m1tuz.lly crntra, i ct-ry , i.e.

These two conditional elements are logically equ: valeant to follav~ing

formla: I if #Ib-n then ( ifB Lteni Selse S2' )else faj~xa

But in present case the conditions c=~. te true sinultanecucly, n.n4

in that. situation we have to choose one of thlose S~ £oloving the1m.

4 '- I-l J

7ne logical mea~n~g oa the ].atr is quite diff erent f==m t-e f orzer.

Let the cornditiLoraJ. aJlsrents t-raneor~zd from~ guarded comn: ZTr-:

-In: 3 t 1-1: SIZ; n: B2'.14'1: S2I -, I: !A -,B2 *)fhext;

'Mese ~ ' the odt2.Zen~e~zaelgical.2.y eqvuiva. nt f olcjZ c=3

I if #2bwn then (UP BI'AB21 ther. S2

else (if' Bf thaen 51'

els', (if fl2' then 32 else oil-xax'

hiere 5S272z' Sn that (S~SASA S2)

(v) The rer-ctitior i. tzran.sfczrnd az fo3-Icw(as~'ng :In Pi):

-~-n:.(Bk)-?lk: i(SAiL)< n'

pB)>i next;

(4) 7-e -ciansforratiori of nu-OY tPUt ec-CM-1~2

4For inp'_-out,?a, 00=zra-rd ca Occ _- az -t, tn--t.3 a bi:cZ6 ozr -- n

-V div-§.c fol wi' z ~~ into .. t'OCases:

(i) As st.-aements (aa.zutir~g in Pi):

For any input coa~d Pjlxij or output conand ?I'Y-ik in" Pi, -az POin~ed Ou.t

In (?), tvo boolezrn #rjj and #sik have beern azaigne. coreeporndirg t3 tlhese

two ccn=ands rezr3 ctive.2y Z:,-n these commands are transfornad aIZ fclJlOw:

hex~s& .o is a labial in the part c rn to all processi. In aidition t.o 0-bcr

transtor-mation, corresponding to Pj'txi4 wO =it ins.ert fo2lwir g ontor2

elexent wider the label co=:

00=1.: 4rij-TA#ji-T > : et~. nsj;

here nextriJ, nextzsli are the next label of Pj~i in FP4 and t.1at of Fi! j4 in

P~ respectively. Aa for Pk.! ±k, we nead not inczert the corr ~pndirng condlti-- '

al eloment in cc=,1 Xor its input partner Pi~ki in Pk would do thLat.

(ii A; Co1azas (L. x±in i

lct iis assi=r. tl-e gaded conmxmd T~)-e they occar i.s of~ f lowi.. for---

rt. 4D IV V; b; V v ~ Oo r, T ...

As Lm the case (i), there =zst be a co:-Aitiorna ele=-at, in cc= xrso:,i

to each input cc=3nAn. iitao't 1J-ss cS garera.zity, -vi neei o::-, colsidC~r

Pjijlwe en a150 b-a safe to azssu its Otz U1 .Z.'7' i Pj1l~t

~c~~irg ~ ?iyji;' : -* ti3 cLnitioia2 e-~a in ccr,

c,.)=: A iT~~i~~I~

eth.er th;.n bu t cX=r2~J in -Lac zx-- gua:-2122tLZdz

-tz'm are as--iizd wi.th tha valiza fa-le-; + ''

Fnaljy2, ther-a are sti: ' fec22.uing labels :.C4 acnitimA! elauents ir Pi:

IALI

he iv nexct is thie label before th~. s -zterzt t,-- t--, rie t c,- $.

Le se= 2Zin tfle abo-8te 5_a11fratz r- -.n. i t:;iala e'm'-=e cuotZ &~cA,

S7a=Pie 1. P::LP!//P2//P3!

To apply t~e trnsformation jt.'er. L-cve tc tails CS? prog-.=, ZT /!:rogram obtajed. is a~s - o11c-is-:

F- 11 P1At2 1~3 P3;

113: b2lrrh3 -, s*l2---T A-Z 4r~ I "%C C

112: !:(S)All2.13;,

11:(4 'I1 :-13;

.2z,(S6 "A 2 P2;

j33(.,b2)Ab3 -T end!;

cc=.- ~ m '~OA~l4- ~2 FA~S F ~r1cr~?

61" PIC;

The Formal Sjerwntics of Zhou-Ho"-e's CSF with d-Ca.es

Zhou-Hoae (ZRL) i.ntrodces a forr.al system to -:reate CSF with rt-.. cn. cls

-and has proved the validityj of the proof rules by -,r:r~s of dxnotation-.i semantLizs.

in spita of its mathemaic:Q_ sorhistication, tn- aturcaoh stea7s o corllateci.

This author ds that the CSP with r areo zh&riels can be. eaLilv ara tvar, vn re

naturaly described -with the temporal logic language XLfX E with -Le consequence that

..e proof rules in their system becorn, theorems of =CYZ/E which can be proved within

the -r=,.ewcrk of terrpora.l logic instead of using those complicated tecrn -cas of

denot.tional senmntics.

in order to describe the CSP with rmad char.els, or equivalently, -;z tr'nsfo.m.

"he sezantics c Zhou-cicare's 3stem into XZfiE, we enu4erate irfor. the corres-

ponaence of the basic notions of these two systeins as follows:

-The process in their system is transformed into a procedure in XM/E;

;The charels :n their system are transformed into /G variables (i.e. -nat

;i-artacle, ou.u1 variable, or input-output variable, they are dacl .red in i part,

";o part, cr io part ras.ectively) of the procedcr.;

-The type of -he values of the c-annels is treatec, as a.locationa. fr:.rla ; as in

S(.2', we aliw sets as allocationa formulas;

*eIn order to describe the relations between tie charnels (1/C variables)- of differen[

processo. (procedures), an I/0 varia.bl6 used outside the procec~ure where it is defined,

must hz.ve its nzze prefixed "Adth the name of the prccedure connected with a hyphen,

for ex.nple,"'eopier-wre- r,.ccpier-wire" ueans that the value of the cr:an.al wire in

irn process copier is equivalent to the value of the channel wire in th- process reccp.cr

-The process expression of a process equation (7 _A) is transformed into the condi-

tioral expressicns of the algorithric part,i.e. %a part of the correspondin.g procedure

with the convention that the process expressi .ns are transforred in acczrdenca wiur

following rules:

(I'/ in order 1:o transform t:'e excressicr the f'crn-;- 3"zc.je need to C 'J

sone conmments on: t-he operation n-~ used inI Z*-zl. To ry' understand.gn, I.A+.B: ii Z-

cugnt have t-he =eaning that "if' A then suibsequewntly (or" eventual4) 3". E3ut if we

explain this operatior in this way, thea e.:%pression "A-,,3- 0> ough.t to) near *zat

*A then subsequently that f then suhsequ&nt: y 0. in tais case when A -Molds iJt is

not necessary that B mtust holds sifbsequently. To from t.:e ex:.;--Zs in (ZH:.) 1

*believe it is not whtits z&athors intend to mean. tIn - , itis mi.sleading to allo~-

replacing the B in "A-?B" with "IB.* C ". So in following discussica, rno such kindi of

the fooci of the expressis a3 "A-,;(B->C)fl is allowed. We exp;ress what such excressic.n

-L.nternds to express as "A-,'B; B- C. For this k-id of axpre ,sion, thre crzfr~cosa-,-

(2 ) In 11c! e-> P, c i s transfSormed in to an output o r .n vt-ou tput vaariable .c aand e

i.s transformed into a corresponding expression; so tha whola expression 4s =ansfcrre5 '

as ie>)-lc.3el)~) o-t,. thiis variable -!c -ust be declared a-, t-he ' o or

ca-rt of -.he -crocodure.

-n c~:M " c is trasf;=med into an iput cr irnut-c"tPat va-riable -C whiobh

i.s declarad at the ~ipart or 5 io oart of the procedure; x is a local. variable of ty-

M which is also c 's trpa, declar-ed at I,-v part of the nroceduze. H~ence, t-*.e Whol~e

expression is transformed as P(CX:N - 5c# =()

(4') For the ex-cression (?jQ), we assimg a con larel, sazy lpq before both the

transformed exzressicn of P and that of Q. Ths(PQ -lq 1 (P) -'I(q )

( A- for (P xij iy : ) and (chan L;F), it is natural to transform thase f-orm-.s in-.0

eaecdigsubpro-cedures in an: outliyer procedu2re and ex-pre.esin-g the reations anong

th -eir I/C variables as equations in the %a Pert Lf te outiayer procec,.u'e. We -ill

explain the transformation by the examples below.

6)Stop is trzrisforned to stop.

.xzt 2. iven follow-ir., rcccso znA Z -- o are, 2 t

0c.ez - i L~u'X- N.176 e~; ~c~

z~cir (-wir--eiy: NAT o utr-u; vt',---y -~recs:ier.

___ -pu ,pir recierK reoir um

-the -,IeL~ra it a t bc;prcesses .znsf orrxd a

-u- .:%NA 71

copier:

44recopi;er:

VLy

,a 1 .iM: .C oie r -% r", per A rl ,co.

sancir -' (input?y: H -. qjyl).

receiver A(wire7~: 'A (~e~cW-ireAOX Outo tp. Ou~;.:

wirf-NA.CK X :~zie)

,rct,-col -. (c:-ar-, wire; (ereri ~e ~~r

T corresconci nv oic-,oria2. rsrvltc is az XZzs

;rotoco1 _____

i rnat ae r ~Ai4re Ireceiver CuW~'t

The -%-ccei. are i "~ z-to~2s:

~p sander.:

4;v X: ;

lq: 4%re.-

~odi~: !AkieNAC-4

outut:

VL7.; M";

*'-Alre' z wire-ACX;

I 1ta-- P x ni an -s

-. , r- -.- n -i- ; crvex n, -,naI ru - mmI

1 1, r o f r I rz f Z 3 Crare --- "-" -' c-- ;.

11~~~~~~~~ V-- - - - - - - - - - - - - - - - - - - - . -

-ram .a.: v-ma'; meviliity ;c ; o:inm c~~

TLie Formal Ssmantics of M~YhsC?

)!ao-Yeh' a C? is a language concept for concu-rz-nt progra=-ing introduced L

(Y-11). It S ubst nti.Uly cynonymus wita JADA Ta.-king. For z the conzept of OP

ha.,- been merc neatly &-fined in (M~X1), it is chosen as the model in cur discussion

in thisc papx~r. The me-thod intioduced here can be reamcvad to deal U~thAA Tazking

3n an obvious wqr.

In order to save time, we aecline to introduze the concept of CF in detail- here.

MAo-Yeh' s papzsr (1) is ascmmd. Roughl~y speaking, in a concuarrent s.Vste=,there

are two kiis of procass; in-tcr processes -ju-ch receive ;e sages-; Lez:.-ant i:--cessf,-

whbich z;,inc aecsages. MThy Lc .harge iidonr~ations kin~htre dis cL* zta-czents:r

corziect statement which thec servants use to send =essages ;-oQ P-t statement w.ch

the masters use to receive measageo 'rom the ser-gants through some ports which are

buffers; and the disconnect statement which the master -ases to release the

sezrvxitc af --r thea messag~es .nrZ:Je been :receivad. Mai former two kirds of~ sta-enents

conthiri a lis-; oi' para=9tarz to ir'-, 'atev zh3 nami -f the xasstcr, the -ervant and

tht port ar4 al-co come inrat aad inpuAt-output pa-t.rs tw stox-3 thea :ssages aad

Lzmformationj to be exchanged.

(1.) Assuimptions.

(a) Wea astin there are- n masters wkxse naznis a_"e i,.,;k ser-Vans -whose

namess are s±,...,sM and I. ports Pl...,pl.

(tFor simplicity, w-t assame the parameter lista of afll connect statemants

and the port statements are saimnia: thty all have a parametar for theM ariy "

meaiter i.e. mx, one for the port i.e. p1a., and one for the servant i.e.sz;

besides, the formal paramaters. c, informations in port statements ame of

fc2.lowing form.

the input formal paramters are: if' :T1,...,ifs:TDs,

the inpait-outpmit formal parametera are: vf!: T f....,vft: T't

lie corresponding a~ctual parameters 1.n cmneict statg-ynt ae:ii,..,a

(c) ~Z.ea kInds of st ,.~~ns to bc~tse r f~oi~Tr~

i. -the connect statenent is of the form:

CONN~ECT( mi; py; sI;il.,a; val,...,vat)

2. tac port stl.tement, has the form:

J*rC'iconnct sta.t-Mazklt i.s -

(2) Systemn variables.

We are the uye tem, has been suxppli.ed with followring variables-

(a) Thre-e counters *'Kz, ifpy, #Ksz, th-ey are integral varibJ~es, their ranges

are: U..n, O..1, o..k respectively, tbzy are uzed to indicate the ind.ex of

the name of the master-, t-he poft, and the servant racpctiv.1.,

(b) er~are sevbr:"" ;raya of anxi2iaut variab' s-

o-(~)-(K~y.. Ksz-1.Of type 1.

.)- of tylh ?'11 (i.e. =oiator of Ti)

~ of %7pe B (i.e. boo2.an)

l-(4#-K)-(#Kpy)-(#Ksz) of type B

n-(#Y=)-(#Kpy) of type P13 (i.e. Pointer of bCok'.a-On)

(3) Transorations.

(a) counect statement:

04 (14r fezoj~ b7 t&I .. Ap..-.= -(py-,stJ 'l#ias

oi-p-(=x)-(y)-(sz)-I-aIA ... Acp-(x-p-sztva/

(b) port statement;

C01MITION coid;

SVANT s-i,...,szq;

BEGIN ZNM ~PORT) -

d-r'-(p) + x-(uz)-.(py'-(szq. )u' m - --- p)( Z -4,A..

h- ynx-(Qy) #-(~-~y)-sz)-Tmmoipmm(=)(y)-(=z)-IuqyfI(.. .A

(c) dimaonnect statement- /3(3! -)ol-(c-()

Fo1.ow-i', exznpla ij tzLken from~(i.J

rExamoe Z. Se~pho

PROCESS saranbhole

v.aR S: fL-qZ*:7 M;

II ?ORT( se~aphore; p)

=.M--TON .3>0;

S:.se-i; EIMPORT

EancYCIE;

END;

PROCESS-" ql;

BEGDT

6* (Prcs~jr, witlicut resouzcne)

CCNlGCT (zemaphore; p 9* .. (using resource)

COMNCT (semaphore; v;%O

.. (prOceBSirg without resouzrce)

41th transf~ ration rula:s givexi in (3) applied to tis CF program fa. £1c.n-eu2z:

~a ,#s.1 4 cycle;

* b_(sem~)-(p): #s*O .42 b-(sez)_(p);

Cn2d: T~yl

qi*.~

t(e)()-i)-T o- _s=-) i. -(smpp(

313

Oflcour e n hi e~rl there are rW ~nforma.tions e.g.'sern'c3z 'Deo tt4~i.

Ackwedgen~et: This work wr.s ciori- at 1t su.m-rr~n visizt to The

DepartmenIt of C.-=puter Science, University of Mrylan-d, College Park. Frof.

T. Yeh ha:- done a lot of help to me. The authaor is very grate-,U2. to h~i- and -Usc to

Prof. H. F-ills f~i Their friendly encouragerment. I a2.'so enjcyed =uch dithi. ~e

concurrerncy problezz 7,eth Mr. 3. B * (en during T-y v'isi_ the.re. H is waxrn rL;IZ to is

apprec ~ated.

-REFERENCES

(AFRI) Apot, K. at al. A Proof System for Cc=unicating Sequen~tial. Process,

(CC!) Cousot, P. an~d I'%. Cousot, Seinan-dz Ara2,'sis of' Scmctn equ2ntal Proces,,.

CRIN-80-P033 19bO.

(P4.) 1Francea, N. et al.. Semantics of Nondeterminism, ,:oncurs-nq, ana Cozunication.

J. Corp. Syst. Sci. Vol 19, 1979.

* ~ .-i~) Fcare, C. A. R.. Co=micatimg Sequential Process. CA,':. vol, no. c:. 197c,

(11) lchbi;.a, j. B. et 0--1. ?t'el~=in-ar ADA Reference Mant=ta2. SIGPA1 Notf.-_c, Jlxne 1973.

(1.1 ) l~mport, Al. TIIw Clocks, and the Ordering of Events in a Distributed Sysltem.

CACM vol. 21., nio. 7, 19783.

0"I1) Mao, T. W. and .1. T. Yen, Conmnicatic~n Port; A language Concept for .Concirrent

Prograixing, 1EEE 'Iran. on Softw. Bng.' vol. S-6, no.2, 19b0.

(TI) Tang, C. S. 1.oward a 1L-.ified 1,ogic Bamis of Frogranming Languages. T-o ap--ear as

Techn. Rept. of Dept. cf Comp. Sci. Stanford Univ. 1981.

(T2 ____ _,A Hierarchaical. Specificatior.-directed Programn esign 1Yethdolo~r. Draf

19e1.

(Z'U') Zhotx C. C. and C. A. it. Hoare, Partial Correctzness of Co-.irnicatang Sequential

Processe3. ~