Complexity measures for concurrent programs based on information-theoretic metrics

Complexity measures for concurrent programs based on information-theoretic metrics

~n~onns~ion~ro¢c~ng L ~ e ~ 46 (X993)4S-~O 29 Apd~ X993 Cea~e£VV. meass~:es £e~: ce~cs~se~t ~:ogsams based o~ £~£e~:maS£e~°thee~:et£c Shi~ Ch~, Z~ S...

620KB Sizes 0 Downloads 70 Views

~n~onns~ion~ro¢c~ng L ~ e ~ 46 (X993)4S-~O

29 Apd~ X993

Cea~e£VV. meass~:es £e~: ce~cs~se~t ~:ogsams based o~ £~£e~:maS£e~°thee~:et£c Shi~ Ch~, Z~ S~g Chu~ ~ d Y o ~ 1 ~ Ewo~

C~, $., ~.$, Chu~ ~

Y.R. Ewes, C ~ p ~ c y ~ ® ~ , ~ for ~c~n~n~ ~ ' c ~

b~

~ ~'~o~-¢h~o~i© ~ ,

where K is a ~ s ~ a n ~ , ~ d P~ is ~hc p r o b ~ b i ~ of ~v,cun'cnce of ~hc cven~ L Fo~ convenience, wc ~ e 2 as ~hc bas~ of ~ogarhhm and u ~ i ~ fo~ ~ .

~0-01~/93/$~i.~

© 1~3 - E ~ e ~

~enca ~bnishem B.V. ~ ~

~se~ed

43

Volume ,~, Numb¢~" ~.

~NFORMAT~ON PROCESSING LETTERS

occu~ence of a h e ~ o~ ~+~i~is ¢ ~ H y p~ob~b[c,

~mu~ ~nf~nm~ion. Howe~cr, if ~he co~ is bi~s¢~, ~he~ ~h¢ f ~ u ~ gi~es ~ow¢:+entropy ~h~n i= ¢h¢ c~sc ~f ~ unbi~s©~ c~in. F~om such ~ hin~, w¢ czn ~¢g~r~ ~h¢ ~ u n ~ of i n f o ~ i o n in ~ co~currcu~ p ~ o g r ~ ~s ¢h¢ ~¢°

gf ~ s ~ e

h ~ ~ hi~he~ p~obebi~ ~h~n o~he~

:

29 Apr~ IW3

T~b]e I Concu~renmy s ~ e s ~or ~ mmmmpO¢program in Fi~.

2 3 4

I~ 12

su~ be~i~ sub~ Tt.O

be~i= be~in

3 4, ~,

TLP ¢n~ s~b~

= -

~mn~inm~ ~3

~urins ~n ¢~cc~iO=o A ~i~¢¢~¢d c¢~ffc i~ ~h¢ con-

~¢~mb~¢ ms in ~h¢ ~oss of ~n unbims©~ c~n° ~ ~hich ~ssigns h~gh~y-~r~Icrcd ~ = f o ~ i o n

~c~

~¢rm~ion c ~ e y e ~ in mn e~ecu~ion of ~h¢ p~Oo ~ m , ~hc~e~ c c ~ i ~ y ~ecre~ses ~+:°Th~s is ~he

p~m.

A c~P+c~mmcy ~t~Py is ~ p+~ ~hich

c~c~scs ~ se~¢nce of c~cu~ency s~e~, which is ~ usefu~ ~ca~c ~n showin~ ++ s¢~u¢=cc of

T~ ~i~i ~h¢ c o m p u ~ i o ~ of ~h¢ c o m p ~ ¢ ~ of fb+~t~ ¢oncu~c=cy his~o~ o~ which ~g~ concuP rcncy s~m~es~r¢ uniq~© ~ h h ¢h¢ ¢~cep~io~ of ~h¢ T~bI[¢ i shows ~h¢ c~ncu~c~cy s~+~cs ~f ~hc p ~ ~n ~Fi~u~¢ I. ~cp~escn~in~ c~ch ¢~ncur° ~¢~cy s ~ ¢ mn~ ¢~ch ot i~s possible n¢~ ~m~cs

currency ~++ph+ Se~ec~nS A ~ ~s ~ m ~ e l ~.mn~um~e, +e s h ~ how to de,me ¢h¢ ¢m++opy m¢+i.p~¢s°

~min

8ubr

begL~ subr~ ®nd ~ a i n

d e c l a r o T~ bogin T~oQ; TI.P~ ®rid l u b r

Tmm~~ begin :~¢op sel-ec~ • ccep~ P ¢r ~¢cep~ Q;

end ~.¢¢p

~r~ph o~ concu~cncy s~¢cs, E~ch concurrency F~g. I. An ¢r~mp~ Ada t~kinj p r o ~ r ~ F,XI.

Volume 46, Number I

29 Apzi~~ 3

~MFORMAT~ON PROCESSING LETTERS

The fumc~ion / ~ gn~y bc implemented by ~s~e ~ook~p ~h~ch invo~vc~ buildimg ~ mc~ory

~

e~ccu~iom ~ u o u ~

~o ~c~cc~im~ ~n ~rb~rsry

~ocs~on of ~he mc~o~y snd ©~minin~ i~ c~n~:¢n~-~o ~cc~us© ~hc con~cn~ y~ occurs in I ~ ] ~oc~ion~, ~he ~r~bsbi~i~ of ch~.~in~ Yl is

C cram bc ~¢m ~n (2), e.,~mpu~io~ of ~h~ ~oum~ of im~o~miom c m ~ i ~ ~ m p~o~mm ~hm

~)o ~o ]Im~ommm~om ~@m~m~t o~ ~m~zm~m~ I~mC~mmm~ ~c

~crm~ims~~ e ~ ~f ~ concu~rcm~ p~o~r~m b~ ~dcm~i~i~ mm~ ~ m ~h~ mumb~m of p ~ p ~ ~mcumrcmcy hi~oricm b~ ~ m m d o ~J~m cram ~mmflyb~ clone ©r~zm~mimg~h~ c~rr~m~im~ c~mcurr~mcy~mpho From mo~ ore, w~ umc mo~m~ion~X~(P) ~o~"~h~

c~mcurrcm~ ~ s ~ h CO of • c~mcurr~m~ ~d~h e~~mm~ms~ m~e~ ~ for pro~mm P am~ ~or m~

~

em~of m~ pmop~zr~m~ur~©m~ hL~o~©m ~ndim~

pmm~om~

~m~o di~timc~c ~ © ~ of ~th©domain, X~

bY 9, 11, 14. ,~',~rdin~ ~ (2), ~h{ smoun~ of

~ain

aubr

T u ~ TI

T u ~ T2

b®~Am

d®c~a~o T~. T2 begin

b®~in loop

b®si=

subr~ end ~ain

T~.F

aelac~

®n~ 8ubr

®rid Task T2;

accep~ P; or accop~ Q~ e~selac~ end Zoop end T u ~ T~

FiB. 3. An c~mmp~eAd~ tuk~n8 p ~ ' ~ m F-.X2. 45

~a~n

~ubr

T u ~ Tt

T u k T2

b~8~n • ubr;

~ec~are T~o T2, T~ b~8~n

b~la a¢¢ep~ P;

~g~a T%.P;

T u ~ T3

mm~m~+ a+cmpm ~:

®n~ ~ubr

mn~ +am~ +3+

Fi~. ~. ~ ~r~up]~~ a ta~a~ pms~am EX3.

calculated ~sh sh~ ~oli~in~ ~uanfitiem I ~ I -

-

~°~.

S~flar~y, we ca~ ©ompute the ~for~atio~ ~ n t e n t o~ p ~ a ~ s E X 2 and EX5 in Fifo and ~ usinz Ta~ne 2 which is She resuhs of the ~i~ of the p m ~ a ~ . Tabne ~- aim ~fivm th~ r©levant ~ua~Sities of p r ~ r ~ ~J~L ~ e F~k~ ~u~ in Table 2 s ~ i ~ i e s She n u ~ e r ~ t a ~ o f eac~ p~o~-am. ~I~ the ~ ~l~n, the n ~ ~ r w~hin parentheses indicates ~he ~ u ~ r of the Ser~aina~ staS©s. "~e ~um~©r of p ~ r ~ao ~ r r © n ~ histo~©s endi~|g with ea©h of the se~r,~i~a~ stat©~ i~ ~iven in she ~ r C ~ ~

u~m fo~ program F ~ 5 i~ ~ef~ bia~k, because there e~s~ o~17 o~e t e ~ a ~ statea ~ a~ proper ~u~enW hi~sorie~ e~d with the ter~ina~ ~tate. T~is i~p~i~s thas info~ation containe~ in ~ X 3 is none. In other words, the p ~ r a m e~cution er~bits no uncertainty; any e~ecution of g g 3 ]~ads to the seminal ~tate.

a~tai~is may r©pr©s~t ~ith~r ~ a l s~at~s ~r a~ua] stat©s such ~ ~ a ~ l ~ a ~ parallel u ~ a t e of shared variables, a~thou~h spuriou~ ero ro~ ~ue to iafeasib~e eaeeutioa paths n a y be re~rte& ]~estrictin~ ourse~ve~ to ten~inal ~tates, we ob~n~e that ~ the probabiiit~ of reac~in~ a ~or~aa~ (t~iaaD ~sate ia~ee~es, it i~ ~e~ l ~ e l 7 that the pro~ra~n ureter ~n~kier~fion wfl~ ~n~

% ~ %o ~ ia the pre~ous eaa~ple, the i~o~~ t i o a ~ n t e n t of the p ~ r a m F _ ~ is ~ p u t ~ d ' T~b,e 2 T~e resu,~sof anal~is of ©~mple ~S~'eat.~ EX2 a~d F.X3 h~s~o~es

~o~h ~7~ - 1 / ~ 7 ~ ( ~ lo~z 25 + ~ lo~ a ~ +3~ ~o~ ~ + 52 no~ 52)

F.,~t

2

..~+(3)

FJ:~

3

30 {4>

E,~3

4

5~ 0L)

- 1°~°

X®- 3 Xu'3 X~-3 X~ = X2 - 5 8 -

¢oua~¢~ a dcad~OCkoTh~s ob~©r~at~oa ca~ be ~ a t ~

Ix~l

~

= ~T

OxI

(~)

~°~ I ~ 1 '

~ ¢ a , we can ~efm¢ the , ~ k ~ o ~ of the c~ncu~¢n~ p ~ u as the ~a~o of ~ to ~h©

based o~ ~h¢ view t h ~ i~fo~a~on ¢~n be ~hared

H

o

where ~h~ system $ is pavilioned into subsystems

,~ -

(~/~~o~ ~ / ~ ) / ~ o -

o°~°

which arc a ~ub~t of ~ncun'~ncy ~

i~

.

o~hc~viS¢o 47

Volume ~ , Nuznbe¢

~HFO~MA~Ob~ PROCESSING L ~ R S

7

8

9

29 A~ri~ ~993

IO

order 2 wi~ be rcf¢~e~ ~o as a t~c,~ ~ask d ~ c r o Fi~. ~. Ob~¢~-usumpfion ~b~ of p t o ~ n ~ L

However, ~hcr¢ ~r¢ m~=y co=cuzrcr~¢p r o ~ s sc~s o~ ~s~s such ~h~ ~h¢ ~ s ~ i~ z s¢~ do ~o~ c o ~ u = i c ~ ¢ wi~h ~hos© h~ ~r~y ocher s¢~s. ~ s ¢ ~ oz~ Chis ohs©r~fio~, wc ~e~ne ~h¢ ~rnou~ o~

~hic~ h~s ~¢¢= u s ~ i~ s p c e ~

up ~hc ~=~ysis sid¢~" the p r ~ g r ~ F~/L i~ ~ .

poa¢a~s ¢~ the task ~raph TGo Z~¢ ~

L This program

o~ each

S~ep 3: L~s~TC b~ ~h® ~i!ff~©~ b ~ n ~¢ ~ (TC~..... TC~ ~ $ ~ ~: ~ (7~ @~), ~ ~ffor~n ~ ¢ ~ : such ~h~

Ad~i ~h~ c ~ i ~m ~'~ S~p 4.4: ~ f f o ~ $ ~ 4 ~ i ~ T C - ~.

~ F_~.

~h¢ ~ ~ ~ d ~ ~

¢~n.

L~ F ~ b~ ~r~.

Vo~urm¢46, ~umber I

]iI~'FOR~u~'HO~PROCE$S]ING~.~TTERS

i~, a tr~a~ task c~ustcr in~tead of each ta~k in the task c~u~ter con~ti~ute~ a ~ub~tcm.

51 ~4a~

~

T1 T2

I 0

~

29 A~i~ I ~ 3 52

55

54

$5

56

0 I I

I I I

0 I l

1 ] 0

0 I I

Fig. 7. The ob]ec~-a,~ump~on ~a~l¢of p~ogram F_.X2.

~¢f~o Regardin~ a tr~via~ t a ~ chmter as a ~ u b ~ tem~ ~mp~ies that a~ row~ of the c o ~ e ~ n d i n g ob]ect-a~$umption ~ab~e is identical C~ear~y, the e ~ e ~ entropy of the ~a~k chmter, C(S) i~ ~($) = H(5). Therefore, C(3) ~ O. []

c~em

can be ~ e ¢ e n ~

l~m~o We mu~t pro~e that the t a ~ c~u~ter~ ~ati~f~ the fo~o~ins requirements: ~ t t a ~ in a ~a~ c~u~ter he T~,.+., T,. ~nd the ~ t of ~hared ~chromized ~tate~ S. Here, ~e om~y~ho~ ~hat :the tint requirement i~ ~ati~fim~ because the p r ~ of ~ ¢ ~cond requiremerit is trivial (~y ~mtradiction) S u p ~ e that there are t ~ ~ and ~ ~uch that T~= ~, i.e., they c o - - u ° n~ca~e ~hh each other but not ~ t h other t ~ m . 'Fher¢ ~hou~d e ~ t at ~ e ~ one ta~k ~n the t ~ e ~ t e r in .~yuchr~n~ation ~ t h one or ~oth o~ the tas~ ~ and ~ because the ta~k c~uste~ are ¢ommec~e~ com~memt~ of the ¢ ~ e ~ m d i n ~ t ~ ~a~h~ a~mordim~to Definition 6, which ~ead~ to the c~ntrad~ction, []

of a prepare S i~ defined as the total ~ c ¢ ~ entropy of 5, C(~)= ~(7~'~..~C(e~), 0}, where ~ ¢ of the t ~ c~t¢~ ~,°oo, ~ i~ tr~v~.

E ~ [ ~ e ~o Pro~ra~ EX2 ha~ one non~ia~ ta~k c~u~ter con~i~tin~ of three t a ~ , Maim ~ a ~ t a ~ TI, and ta~k T2, which can be dir©ct]y ~hown by con~tructin~ a ta~k ~raph. Let the ta~k c~u~tcr ~ TC an~ the ~ynchron~a~iom ~tate~ ~hich e~ibit the ~ynchron~zation re|ation in the ob~ect-a~aa~ptiom table of Fi~. 7. H(Ma~m) i~ them con~puted by con~idc~n~ the c o ~ u ~ for which the mmt~ for Main i~ t, ~ay, S~, $3, am~ S~. I[n a ~ubmatr~ compo~ed of (0, ~, 0) occur~ om~y once. "~e to~al number of ta~ ~ 3 and

~ ( t r 2 ) ~=~osz ~ - i / ~ ( 2 ~oS~ ~ + ] ]o~z ~). S~ncm ~ ~ c u m on each column at ~¢a~t once and each row is different, H ( E X 2 ) = ~og~3 and

•. I.B~6.

~ ~o Em~ination o~ the ta~k ~ a p h of the prog~a~ F_~3 re~ea~ t~o tri~iel ~a~k c~u~te~-' one i~ composed, o~ ~a[~ t a ~ an~ Ta~k ~, an~ ~h¢ other, T a ~ ~ an~ T a ~ ~° Therefore, the tota~

the e~ce~ ¢nt~o~ of a ~ e n p~o~'a~ $ accord. im~ to Definition I0.

t a ~ c~u~ter,

~he~ e ~ 6 waeh~o~iza~ion~a~es f~om ~he co~es~ondin8 concu~cncy ~'aph. 49

Thi~ L~zp©r z i p s ~o provi~I¢ s forra~ ~ s i s on

(~] A,L Baker and $.H, Zw©ben, A c o m O a ~ n of mcaau~es of ~n~ron flow compRe~y, IEEE Tra~. Sol.ave E ~ . [2] $. Damer~ a~d $.1~. $ha~z, S a ~ a r e ~ m 0 R ¢ ~ / ~ d Ada

~75,

~e~ Sy~e~ F~.

~D, ~ ) . [~] $.~. $ha~, T ~

J. ~7 ( ~ )

3 7 ~ - ~ , 623-656,

~ ¢ ~ i ~ 7 ~¢~fi~ f~ ~ a ~ ,