• Aucun résultat trouvé

Petri state

N/A
N/A
Protected

Academic year: 2022

Partager "Petri state"

Copied!
100
0
0

Texte intégral

(1)
(2)
(3)
(4)
(5)

Distributed generation of state space for timed Petri nets

by

Irin a R.ada

A thesis submittedtothe School of Grad uateStudies in partial fulfillmen tof therequi reme ntsfor the degreeof

Master ofScience

Departme nt ofCormputerScie nce MemorialUniversity of Newfoundl and

May 20() O

St.John 's Canada

(6)

Abstra ct

Developmentofcomplexsystemsisusuallypreced edbydetailed st udiesoftheir models.

Fo r concurrentsystems,Petrinetshaveproved to be a conveni ent modelin g fo rmalism becauseoftheir abilit y to expressconcurre ncy,synchronization. precedence constraints and nondetenninism.Timed Petrinetsalsotakeintoaccount thedurationsof modeled act ivities,facilitatin gqual ita tive as well as quan ti tative analysis of models.Thebehav- ior of Petri nets is representedbytheir statespaces,which areMark ov(orembedded Markov)chains.Forla rgemodelsthese statespaceseasilyexceed the resou rces ofa singl e computersyste m.Read ilyavailable net worksofcomputers providean attractive alternativeto complex methodsof sta te space redu cricnor aggrega tion.

The mainobjectiveofthis projectis to use a cluster of PC's or wor kstationsfor the state space generation of timedPet rinets . The distributed algorithm uses a divide and conquertechnique:disjointregions of tbe state graphare constructed 00. differeDt machines. Oneach machinethe communicationisseparated from the computation part.andisperformedby two specialized concurrent processes:onereceiving,and one sending messag es.The implemeDtationisbased onPVM(ParallelVirt ual Machine) usingamodified versionofTPN-tools, asoftware package forthe analysis oftimed Pet ri nets.Experim en ts performedon acluste rof32PC' s connec tedviaa100 Mbps Ethern et showalmostlinea r speed upforsome classes of timed Petri nets.

(7)

Acknowled ge ments

IwouldLike to exp ress my since re thanksto my supe rv isor,Dr.Wlodek Zubcrek, for hisguidan ce, help,andthoughtfulness throughoutmyprogr am.

[amgrate fultothe SchoolofGraduate: Stud ies and to the Departmentof Com puter Sciencefor financialsupport.

Man y thanksgo tomyfriendUlf Schiinemannforourdiscussions andhishelpful comments, andtoNolan White fortechnicalassistan ce.

Finally,I want to thankallmyfriends formakin gmystay hereenjoya ble,and especiallymy famil y for moralsuppo rt.

(8)

Contents

1 In t roduct io n

2 Petrinets andst atespace generation 2.1 Introd uctiontobasic Pet ri nets

2.1.1 BasicPetrinets. 2.1.2 Extensions ofbasic Petrinets 2.1.3 Selectionof firi ngs forconflicti ngtran sitions 2.2 Generat io n ofthe reacha bi.lity graph

2.2.1 Sequentialalgorith m

10 . . .. . . 13 13 2.2.2 Netpropertiesbasedonthe reacbability graph.. . 14 2.3 TIme-augmentedPetrinets

2.3.1 StochasticPet ri nets 2.3.2 TimedPetrinets

.... . . ... . 17

_. _ 18

19

2.4.2 Con clusion s .

2.4 Distributedstatespace generat ionforstochastic Pet rinets .. 2.4.1 General fra me work.

2.3.3 2.3.4

M-timed Pet rinets_ .

D-timed Petrinets . . . ... .. . . ...

2 .

25 29

3.

36

(9)

3 Distributed statespa cegenerat io n fortimed Petrinets 3.1 Generalconsiderations ..

37 37

3.2 System temporalorganization

..

... 39

3.2 .1 System startup 40

3.2.2 Const ruc ti o nor the state subgraphs.

....

41

3.2.3 Terminationdetection 42

3.2.4 Integration ofresul ts 44

3.3 System architect ure. 45

3.3. 1 Thecom po nents 45

3.3.2 Local commun ica ti on. 47

3.3.3 Messagebasedcommunication. 48

3.4 Algorith ms. 51

3.4.1 The Spawne r 51

3.4.2 The Worker 54

3.4.3 The Sende r 58

3.4.4 The ordinaryReceiver

. . . .

59

3.4.5 The initiatorReceiver 61

3.4.6 TheCollector 63

4 Examples 4.1 D-timednets

4.1.1 Exam ple1. 4.1.2 Exam ple 2.. 4.2 M-timednet s

4.2.1 Exam ple 3 . 4.3 Concludingremarks.

iii

6 .

66 66 70 71 71 74

(10)

5 Con cl usio ns Refe re nces

iv

75 79

(11)

List of Tables

2.1 Statespace for the net in Figure 2.6.

2.2 State space for the net in Figure 2.1.

2'

28

(12)

List of Figure s

2.1 Producer-consumerboundedbuffer model.

2.2 Reach a bilitygraph for theproducer-consumerboun ded- b uffer model . 2.3 Cent ralservermodel..

2.4 Selection graphfor Figure~.3. . .

2.5 Graphofreach a ble markin€S forthenet inFigure2.3.

2.6 Three dining philosophers. ..

3.1 Distributedgene rationsyst-em3 processo rs.

3.2 The struc ture of aGen erotoQT.

3.3 Inter-compo nentscommuni ca.tio n sum mary.

4.1 Executiontime forExampl-e1(a) andExa m ple1(b).

4.2 Speedup forExample1(a)andExample 1 (b).

4.3 Speedupcurves forExample 1 (a)andExample1(b).. . 4.4 Speed up comparisonforExample1 (a)and Example 1(b). 4.5 Executiontime forExamplE2..

4.6 Speed upforExamp le3.

4.7 Executiontime for Example3... 4.8 SpeedupforExamp le3.

vi

10 13 17 21

38 47 51

67 68 69 69 7l 7l 72 73

(13)

Chapter 1

Introduction

Developmentofcomplex,real-worl dsystemsis usually precededbydetailedstudies conducted on formalmodels.Fo rm al,ma t he matical models are used forthe verificatio n of system'sproperties and for the derivation of its performance characteristics[16. 20,

221·

For systemswhich exhib itconc urre nt act ivit ies,Petri nets are a goodchoiceof mod- elingfo rmalism, becauseof their abilitytoex press conc urre ncy,synchron iza tio n,prece- dence cons t rai ntsandnon-d eterminism .Mo reover,Petrinets "wit h tim e"(stoch as tic ortim ed)includethe dur ation s of mod eledactivitiesinto thesystem'sdescript ionand thisallows the st ud y ofperformanceaspectsofthemod eledsyste m. The analysis of a Petrinet modelof asys tem provides many usefulinsights;thenet' squalitative pro pe rt iescharacterize the system'sbehavioral properties[1,

261.

whilethe abilityto incorporatetimeintothedescriptionallows the derivationofthatsystem'squantitative characteristics [4, 20,39}.

Three basicapproa chesto theanal ysisof Pet ri nctmodels areknown as stru ctural analysi s,reach abilityanal ysisand,fortime-augmen tednets,discrete-event simula tion [32,38].Struct ural method s pred ict the propert ies ofnet modelsonthe basis of their

(14)

structure(Le., connect ionsbetween elements) . Structuralanalysis is usuallyrather simple,but it can be applied onlytonetswith special prope rti es.Net simulation[451 is based onthefact thata(timedorstochastic)Pet ri net is a discret eevent system, where theevents arerela tedtothenettransiti on firings(occ urr ences).Simulat ioncan be appliedto alar ger class ofnets ,butmay sometimesnotcapt ureeventswhichoccur veryrarely.

Reacbability analysisis the mostsuitablemethodwhen a detailed analysis ofthe model'sbehavior isneeded.Basedon the exhausti vegeneration ofall model's states and transitions between the states,reach a bilityanalysisanswersquest ionsaboutreach able states,liveness,boundedness,persistence,deadl ock existence,etc . [26,32J.Thefirst andmostmemory consumingste pin reachability analysisis todet ermineall the states ofthe net and thepossiblerelations amongthem.This Iafor m auc c is organized io. a directedgraph, called the reachabilitygraph (io.whichthe nodes are thenet's sta tes and thedirectedarcsrepresent thepossiblestate-transitions).Thereachabilit y graph is usedforchecking theproperties mentioned above . For timed and stoch ast ic Pet rinets (wit h determio.ist ic or exponenti al lydistributedfiring times),thisgraphis a Markov chain, whosesteady statebeha vior canbedeterminedusingknownnumericalmethods (22, 34J.Thesteadystat eprobab ilities areusedtoderive performancemeasu res of the net,fromwhich performanceaspectsof thesystemcan be obtained(4,11J.

The powerof reacbabilityanalysislies inits ability to characte rizethe exactbehavior ofthesystem. However,while yielding goodresultsforsim plemod els, this method cannot be applied to nets withverylargestatespaces. Forsuchnets , the memoryand comp uta tional requirementscanbetoolarge fora singlemachine.There aretwo basic methodsto cope withthis probl em [101;avoidance method s, which use net properties toobtain a small er state spac e, andtolerance meth ods ,which accept that thestate

(15)

spaceislarge anduse varioustech niqu es (in particul ar parallel/distrib utedalgorithms) togenerateit. Thecurrentavailability ofclusters of workstations andportable libraries for distributedcompu ting makes thesecondapproachvery attractive:thesta tespace can be constructedinadistributedmanner.usingacollectio n of processors.

While therehavebeenseveral papers published on distributedgenerati on of state spacesof systems[28.30]andon paralleland distributed sta te space generationfor stoch asti c Petrinets[8.6.7.9,23].verylittleinformation is availablefordistributed analysis oftim ed Petri nets.

Thisthesis proposes a distributed algorit hmfor thegenerationofsta te space for timed Petrinets.The algorit hmhas beenimplementedinC+ +usingthe TP N-too ls (38).STL[36],andPVM[18]libraries, andthentest ed on thenetworkofPC's and workst a tionsin the Depart ment ofCom puterScience,Mem orialUniversity ofNew- foundlan d.Experi mental results show almost linearspeed upfor som eclasses of timed Petrinets.

Thisthesis is organized asfollows:Chapter 2presentsthetheoretical background of theproblem andan overvie wofthe literature.Cha pter3intro d uces theproposed dist ributed algorithm.Chapter4prese nts experimental results. Performance anal ysis.

limita ti ons .andpossibleextensions arcdiscussedinChapte r 5.

(16)

Chapter 2

Petri nets and state s p a ce generation

Thefirsttwosectio nsofthischapte r provide a sho rt. introductio ntoplace/transit ion Petri nets andthe generation of theirmarkings(inthecaseofbas icandsto chas t ic Petrinets ,markings are often caUedstates;fortim ed nets,markingsandst a t es are twodiffere nt conce pts) .Section2.3presentsPetri ne ts augme ntedwiththe dur at ions of activitiesand discuss esthe gene ra t ionoftheirsta tespace. Thefinalsection reviews thecur re nt literatureon distributed generatio n ofthesta te spacefor stochas tic Pet ri

The presented definitionsace similartothose in [39}.Thenotat ion follows [39,38J.

2.1 Int r oduc ti on to basic P e t r i n e t s

All basic place/tra nsition Petri nets are characterizedby theirstructu re,theircurr ent marking , and executionrulesdefining their beh avior.Basi c conceptsof Petrine ts are int rodu ced inthe followingsection.

(17)

2.1.1 BasicPetrinets

Defini tio n2. 1A Pet ri netisatripleN=(P, T,A)where:

•Pisa finite set ofelements calledplaces,

•Tis afinit e setofelem entscalledtransit ions,

Aisasetof directedarcs connecting places with transi tionsand transitionswith places, i.e.,A~PxTuTxP.0

Defin it ion 2.2 LetN= (P,T,A)bea Petri net,tatransi t ion ,tET,andpa place , PEP.Theinput set,lnp,and the ou t p utset,Out,of a transitiontora place p aredefinedas follows:

lnp (t )~{p

I

(P,t)EA},Out(t)~{p

I

(t,p)EA}, lnp(p)~{tI(t,p)EA},Out(p)~{tI(P,t)EA}.0

Thedynamicbeha vior of thenet isrepresentedbythe distributionsofthe so-called

tokens associated withplaces ofthe net. This associat ioniscalleda marking of a net.

A net with a markingis called a marked net.

Definition2.3 Amarking of a Petri netN

=

(P. T.A)is a function m : P -+N which assigns a non- negativenumberoftokensto each place of netN. A placep is markedbythe marking mifitcontainsatleas t one token,m(p)>O.otherwiseitis unmarkedbym.Amarked.netisa pairM

=

(N,

mol.

whereNisaPetrinet and

mo

isa markingofN, calledthe init ialmarking. 0

Abasic Petri net isabipartitegraph , usuallydrawn with circlesreprese nt ingplac es and rectan glesrepresenti ng tra nsitio ns.Thetokensare represented as black dotsinside thecircles .

(18)

Example2. 1[38] The Petri netinFigure2.1models a consumer-producerbounded- buffersyste m.Thesubnet (tItPt.~,P2)representstheproducerprocesswhich produces an item(tdand storesitin the buffer(t2)providedtha t there is space forit(condi t ion P$).Thesubnet(t3, P3,t.e,P4) represents theconsumer process,whichfetchesan item fromthebuffer(t3)provided that the bufferisnotem pty(condit ion Pl;) and consumes

Ot() " ....

00

n l2 C ..

o .. 0

.. ..

Figure 2.1:Producer-co nsum erbounded buffer modeL

Thebehavio rof abas ic net is reflectedby thechanges of themarking func tion.A changeofa markingfu nct ionis perform ed by an occu r re n ce(ora firi ng) ofanenab led tran sition.A trans it ion isenabled ifall itsinput placescontainatleas t one token.A transition occurs by simultaneouslyremovingonetoken from all itsinputplaces and addingonetokentoallits outputplaces.

Definition 2.4LetN

=

(P,T.A)beaPetrinet,tatransition,andma markin gof N.Thetransi t iontisenab ledby miff:

"IpEInp(t);m(p)2:L The set ofall transitionsenabled by amarking misdeno tedE(m).0

Amarkingm' isdirectlyreachablefroma marking mifm'can beobtain edfromm by anoccurre nce of anena bledtrans ition.

(19)

Definition 2.5 LetN=(P,T,A)be a Petrioet , and mandm' betwomarkings . m' isdirec tlyrea chab lefrommiffthereexistsatransitiontETenabled by111such that:

{

m(p)+I, ifpEOut(t)andpf.Inp(t)i

"tpEP:m'(p)= m(p) -1, ifpEIn p(t )andp;;Out(t)i

m(p), otherw ise.0

The notationm"";'m'indicatestha tm'is directlyreachab le from mbyfiring the transi t iont,and thenotation mo-+m'indi ca testhat m'is directlyreachablefromm byfiring some transi ti on.

The generalreachab ilityrelationbetween markings isdefined as thereflexi ve tran- sitiveclosureofthe direct reachability relati on.

De fin ition2.6A marking m' is (generally) reachablefrom a mar king m (mH.m ') if thereexists a sequenceofmarkings mo, .. ,m..suchthat l110=m,m..=m',and

"to<i:Sn:mo_ll-+ffit .0

Definition2. 1Therea ch a bility set ,'R(M),ofamarked Pet rinet M

=

(N,mo) is theset of all possible markings reachable fromthe ini t ialmar kingmo,l.e.,

R(M)={m

I

meH.m}.

If theset1l.(M)of amarked netM

=

(N,tn(I)is finite,the net isbou n ded, otherwise itisunbounded. 0

The reachability setofa marked net,toget berwiththedirectreacbabilityrelation, Connthereacha bility graph,whichis a com ple tedescr iptionDCamarked net'sbeha vior.

Forboun ded netsthisgraph isfinite.

(20)

Definition2.8 Therea chability graphof a marked Petri net M=(N,mo) is a labe leddirectedgraphG(M)=(V,D,l)where:

Visthe setofvertices,V='R(M),

•Iisthearc labeling(unction,l:D--t2T;(oreach arc (m.:.mj)ED,l(m;,mj) containsallthosetran siti on swhose firingtran sformsm,;intomj:

Example2.2Figur e 2.2shows thereacb ab ilitygraph(orthe netin Figure2.1.0

[IAl1.lA21~"_

• ..

~

. ...

_ " _

/ .

.'.'.0.0.>:1

" / "

[IA'Ao2I

Figure2.2:Reachab ility graphforthe produ cer-con sum er bound ed-buffermodel.

2.1.2 Extens ions of basicPetrinets

Severalextensions of basicPetrinet shave been prop osed inthe literature.Themos t commononeisattachi ng weightstoarcs (26,32J. Petri nets wit h weightshavethe

(21)

same expressive poweras the basic nets,so theweights are usedonly as amodeling convenience.

..0\.0extension ofbasicPet rinetswhich significantly increases tbe modeling powerof thebasicmod elisthe addit ionof theso-called inhibitorarcs[21.Netswithinhi bito r arcs arecalledinhib itornets.

Defin i t io n 2.9 AninhibitorPetrinet is a quadrupleN=(P, T,A,B)where(P,T,A) isabasic net ,andBisa setoninhi bitor arcs,B~PxT,whichisdisjointwithA, AnB==0.The set of placesconn ectedbyinh ibitor arcswitha trans iti on tiscal ledthe inhibitor setoft.andisdenotedfnh (t ),fnh(t )

=

(pEP

I

(P.t)eB}.Ininhibi to r nets,atran sit iont is enabledby amar king m ifallits input places are markedand all placesinits inhibitorset are unmarked:

(VpEfnp(t ):m(p)>0)1\(VpEInk(t ) :m(p)=0).0

Anoth er import an textensio nofbas ic Petrinetsintroducesthedurati on s ofmode led activities(Sect ion2.3).

There are several impor tant st ructural pro perties of inhibito r nets.

Definition2.10LetM=(N,rna)be a mar ked inhibitor net.A placeissharedifit belongs to the inputset of morethan onetra ns it ion.Asharedplaceisgu arde diffor eachpairof transitionssharingit, thereis another place which is in the input set of one transition,and in the inhibitorset of theothe rtransition.A place isfree-cho iceifthe inp utsets and inhibi torsets ofalltransitionsshari ngitareide nt ical.Alltransitions sharing a free-choiceplacearein a free-choice relation .Aplaceisaconflict placeif it is sharedbutitisneitherguardednorfree-choice.Transitionssharinga conflict place are inpotentialconflict(conflict in g tran sitio ns).An inhib itornet isCree-cho iceiff eachshared place iseitherguarded orfree-choice.0

(22)

In free-choice nets, theIree-chctee relationis an eqcaivalencerelationin the set oftransitions,T,andthereforede termines a partiti on of thesetoftransitionsinto free-choice equivalence classes;

2.1.3 Selectionoffirin gs for con flic t ing transitions

Forthenet shownin Figure 2.3,the transitions shari ng place Phi.e.,t2, t 4,and ee, are in potentialcon8ict.Trans itionst2and t4are bothenabledbutonly one canoccur. A systematic approach isneeded to determ ine allpossibleco mb ina tionsof transition occurr ences fornets withconflicti ngtransit io ns.

Figure2.3 ;Centralservermode L

Defi nition 2.1 1LetN

=

(P.T, A)bea net,andma m.arking.Foreachtra nsit ion teT,enabledbym,its confl ictclas sCC(m.tl,is defined asfollows:

CC(m,t)=(t'EE(m)JInp(t )nInp(t' )

¥-

0V

3t"eE(m ) ;Inp{t } nInp(t" )40At"ECC (m,t' ).0 10

(23)

The notionofchoice of thefiringtransitioncan beexp ressed formallyas a ch oice functionc;T~(0,11,whichassignsfree-cho iceprobabili t iestofree-choiceequlva- tec ce classes andrelet lve frequen cies of firings to thecon6 ict in gtransit ions.

Thediffe re ntcomb inationsof transit ionswhich can start theirfiri ngsforagiven markingare desc ri bed bytbe selectio n set,a set of selectio n functionswhich describe differen t"select ions"offirings.

Definition2.12 (441LetN=(P , T,A)beaPetrinet,andma marking.Aselec- tionof themarking m isa functi ong;T-+N,describi ng apossible combina t ion of transitionswhichcanstart theirfirings form,i.e .,gisany funct io n suchtha t;

1.The reexistsa sequence of markings,0'=(mo,m"..,mt),anda correspondin g sequenceoftran s iti ons,(tit ..,tt l ,suchthatm=mo,tjEE(mj_l)forj

=

1,..,k,and:

{

I, if PE[np (tj ) ; VpEP:mj(p)=mj _I(P) -

0,ot he rwi se .

2.Thesetof trans itio ns en abl edbythe finalmarking mtisempt y, Le.,B(mt)=0.

3.Foreachtransitio nt.get)isthenum ber of occurrences oftinth e sequencea, Thesetof all select ions ofamarkingmisdenotedbySei(m).0

Definitio n2.13 LetN

=

(P, T,A)bea Petrine t,c a choice fun ct io nfOTN,and m amarkin gofN.A selectiongrap hof themarkingm is arooted,directed,la beled, (ac ycli c)graphG

=

(V,U,vo,/,q,qn)where:

•Visa finite setof vert ices,which are pairsof funct ions(m; ,no),I7l.i;P-+N, no :T-+N,such that;

Vp E P,m;(P)+

L

n,(t)-m(p); IEOuI(P)

11

(24)

•Uis a setof directedarcs,UCVxV,such that:

«m;,

n;),(mj,ni))EU<==*3t1:EE(m,:);mi=5ub(mo,tl:) "ni=add(n,;,t,,), where;

VpEP..5Ub(mo,t")(P) _- { mo(P), if p

~

lnp(tl:);

mo(P) - I, ifpEln p(tl:);

{

n,;(t), if t-:jt,,;

"ItET:add(n,;,tl:)( t )=

n,;(t)+1, ift= t,t;

•Vois theroo t,va

=

(m,no),whereno(t)

=

0foralltET;

•f isanarc-labeling funct ion whichassociatesatransitiontETwith each arc (v;, vi)eU;

!«TTli,n,;l,(mj,ni »=tot<==*totEE(mo)1\mi=sub (mo, t,t)1\ni=add(n,;,t,t);

•qis anotherarc-lab elin gfunctionwhich assigns,to eacharc (v"vi )EU,the probability of transform in gV;intovi;

!

10 iftt»;vi) is conflict-free,

V(v;,Vi )EU;q(v;,vi )=

;;(V; ,

vi)), if

leV i,

vi) is free-choice, o::(/I..,,,, J) ot herwise.

LIl: CCC....JI ..."/ ))C(t)

• qnisa nod elabe lingfunct ion,q..:V.-..+(0, II,which assigns aprobabili ty q(x )to eachnodexof theselectio n graph such that q..(VO)=1and:

vxev- {v, },q(x) ~

L:

q.(y )·qC••x).O wEp,.~d("'1LZES-=(,lq(y , z)

Example2.3Letcbe a choice function for the net inFigure2.3such thatc(t;)

=

0.1

fori=1, 3,5,6,c(t~)

=

0.3,andc(t~)=0.2. Figur e2.4 showsthe select iongraph for theinitialmarking (1,1,0,1,0,0 ,1). Theprobab ilit iesq(v,)are shownin brac kets.0

12

(25)

W2~~W , .oJ" ....F J wl .(I.I.O. I.O' O'I,O'O.O. O. O' OJ

I . . ---"--j

w2_(O .o.O.I .0.0.1,0.1. 000.o.OJ

lSl.D <$1.0 lSl.o w).(I.I.O. t.O .O.o:o.o.o.O.I.Ol

...._fO.I.O.o. O.o.t , O'O' O' I.O. Ol

a .. . d.fo.l.o.o.o.O. I :D.D.D.I.o.Ol

w~ lO-5l IU dllkSt u ~ w6_(D. 1.D.O.o.o. l :o.O.o.1.0. 0)

Figure 2.4: Selectiongraphfor Figure 2.3.

2.2 Generatio n of the reachabilit y g rap h

Atypicalalgori thmforthe genera tion ofthe reachab ility graphof a(bounded) net isgiven below.Thereaceseveralvariat ions ofthis algori thm, butthe differen cesare rather insignificant[e .g.,usin gastackinstead of the queu e[7]).

2.2.1 Sequential algorit h m 1.algorithm sequentiaLr each ab ility.graph...generat ion;

2.vat'>no; (* initi almarkin g*) 3. rset ::::{mol; (*set ofmarkings*)

4. orcs;:::0; (*setof arcs*)

S. l.Inuplored:=0; (*queueofunexploredmarkings"}

6. search.set:=0; (*sean:h tree*) 7.begin

8. ins ert(sear ch..s d. mo);

9. insert(l.Inuplored.mo);

10. whilenonem pty (l.In uplor-ed)do 11. TII:=remot'e(l.Ine%plored)i 12. forallm'e&l.Icx:eu or ,,(m ldo 13. ifm'tt&ear ch ..8etthe n 14. r"et:_r"et U{m'};

1S. in.sert(l.Ine%plored.m');

16. insert(&earch.set ,m'l

17. eDdif;

18. arcs:=arcsU{(m,m'l)

19. endfoe

20. endwhile 21.end.

Thisalgorithm constructsthe reachability graphG=(rse t, arcs)fora Petri netN

13

(26)

with an init ialmarkingmo.It uses a queue,u~ored,fortheunexploredmarkings , and anauxiliary search data st ru ct ure,search..set,for efficien tchecking of whethera mar king has alreadybeengenera ted. The funct ionsuccess or(m ) returnsthemarkings directly reachable fromm.

The algori thmterminatesfor netshavi ng a finit ereadability graph. lt doesnot terminate,however,for netswithinfini testa tespaces[l.e.,forunbounded nets).

The infinitestatespaceofan unbo undednetcan be com pressedtoits ccvera bility trceorto itscovera bility graph[261. A mar kinginthecovera bility tree uses a special symboltoexpress thatthe numberof tokensina placecan grow infinitely.Thecov- erability graphcanbe obtained fromthecovera b ilitytreebycollecti ngtoget herthe nodes withthe same marking and redirecting the arcs correspondingly.

Research hasbeencond uctedon handling the case ofunbo un dednets (14,17,35J.In (17),asolutionisgiven fora speci al classofunboundedstoch ast ic Pet ri nets(nestwith exactly oneunbo unded place).Other approachesarebasedon using thecoverability gra phas aco mpressed represen tation of thereachabilitygraph. Se veral methodfor const ructingcoverabilitygraphsare givenin[14,35].

2.2.2 Netproperti esbasedon there achability grap h

lmportant netpropertiesrelatedto thereachability graphsinclud e bounded ness,reada- bility,coverability, persistence, conserva tiveness,Iiveness,etc.Theseprope rt ies are very usefulinthe mode lingofsystemsbeca usetheycan bedirec tl yrelated to the modeled syste ms'qual itativeproperties{20,26,31,32].

Definition 2.14LetM=(N,rna ) be a markednet andka natural numbe r,kEN.

Aplace p of thenetisk-boundediff the numberoftokens assignedto pbyany reachablemarkingdoesnotexceedk.Thenetisk-bounded iffthe numberoftokens

14

(27)

assigned toanyplace byanyreachablemarking doesnotexceedk:

vm

ER(M) Vp EP:m (p) :$k.

A net isboundedifitisk-boundedforsomekEN.Al-boundedPetrinet is called safe.0

Bou ndednetsareuseful in modelingsystemswith finitecapacity resources;finite capacitybuffers,for instan ce,areusuall yrep resent edbyboundedplaces. The safeness propertymustusually be sat isfiedbynetsin whichplacesmodelconditions: the true or false valueofthecond iti onisreflectedby theexistence or absence ofa tokeninthe correspond ing place .

Definition2.15Amarking m ofPetri net Nisdea duno trans itionis ena bledbym. i.e.,E(m )

=

0.A markednctM

=

(N.

mol

containsadeadlockifitssetofreachable markings contains a deadmar king:

3m E'R(M):E(m)=0.

A marked netM

=

(N,mo) hasalivelockif thereexists a propersubsetSof its reach ability set,SC'R(M ),suchthat oncea markingfromSisreached,no ot her eleme ntfrom'R(M)- Scan bereached:

3S C 1<.(M)'dm ES 'dm'E'R(M ) :mHm'=>m' ES.0

Definition 2.16Let M=(N,mo)be a marked net.The net isliveifffor anyreach- ablemarking mand for any transitiontETthereexistsa markingreachablefromm which enablest:

'dm ER(M) 'dtET 3m'ER.(M ):m~m'At EE(m').0

15

(28)

Net models ofoperating systems are usually requiredto be live;the property of liveness implies the absenceofdeadl ocks.

Definition2.17LetM

=

(N,mo)bea marked net.Amarkingme 'R(M)iscover- ab leiffthereexists anothermar king,m',reachablefrom m,such that every placehas atleast the same numberoftokensinm'asin the marking m:

3m'e'R(M ):I1'Hm'1\(VpeP:m'(p)~m(p».0

Definitio n2.18 [26] LetM=(N,molbe a markednet.The netispe rs ist e n t if, forany reachablemar kingm,m e'R(M),and foranytwo trans it ions enabledby m, the firing of one transitiondoesnotdisa blethe other:

"1m

e

'R(M)VtLtt,EE(rn):m~m'::::?t,EE(m').0

Definition2.19LetM=(N,molbe amarked net.Thenet isconservative iff for any markingmreachable frommothe total number oftokens inmis the same asin

Vm ER(M ) ,

L

m(p)-

L

",,(Pl.0

PEP PEP

for netsinwhichtokens representresources,theprope rt y ofconserva tionreflects thepreservation ofresources in a system.

Because bounded. nets have fini te reacha bility graphs,alltheir behavioral properties can beverified bythe exhaustiveanalysis of thereachebllitygraph . For unbounded nets (which haveinfinitereacbabilitysets) some ofthese properties,suchas persistence andcoverability, can be analyzed usingthecoverabilitytree(26, 31,321.

Examp le2.4The netin Figure2.3models acentral serverwith three kinds ofjobs.

Fromits stategraph{shownin Figur e2.5) it can be seenthat the net is live,'safe,and conservative. 0

16

(29)

vt

vi:0,1.0. 1.0.0.1) v2.(I,O.I, 1,0.0.I) vJ:oCl.1.0.0.1.0.I) v4 ..(I.I.O. I ,O. 1. O) 0"'0,0.1.0 . 1.0,1)

\'6_0 .0.1.1 .0.1.0) v7""(I.1.0,0.I,1.0) y8 =(I. O.I.O.I,I. O)

Figu re 2.5:Graphof reacha ble mar ki n gsfo rth e netinFigure 2.3.

2.3 Time- augmented P etri ne ts

Whilebasic Petri nets are usefulfor the analysisof qualitati veproperties ofsystems, they cann ot beused forperf ormance evaluation becau setheydo not represent the durat ionsof mode led activities. Severa lPe trinets "wit htime" have beenproposedby introducingtemporaldescript ionsindifferentways[3,4,13, 5,11,24,25,27,39,41,44).

There arethree main aspects with regard tothe additionoftemporal information toPetrinets: time can be associated withplac es orwith transitions, timed activities can be detenninisticor stochastic,and different"firi.ngexecution policies"can be used.

Two classes of nets in which time is associated with transitions (t imed transitions ) are known as stochasticPetrinets and timed Petri nets.[0stoch as t ic nets,the time is introducedinterms of a delaybeforethe (instantaneous) firing ofa transition occurs;

in timednets,the time determines thedurationofthetra nsit io n's firings. Forboth these classes ofne ts the graphs ofreachablestatesare Markovchains.Thesteady state pro bab ilitiesof the statesofa Markovchaincanbedet erminedusingknown techniques [34],and can be usedfor deter min ing quantitativeprop e rti es ofthenet models.

Thisthesisis concerned withthegenerationof the statespa ce oftimed Petri nets.

An overview of similarresearchthat bas beenco nd ucted forstoch as t ic Pet rine ts , is

17

(30)

giveninthe last sectionofthis chapter. Abriefint roduct ion to stochasticPet ri nets follows.

2.3.1 StochasticPetrinets

Instoch.as ticPet ri nets [4,11,13, 24, 25, 27) thereis a time delay from themoment whenatran si tionbecomes enabledto the momentwhe n it fires.Thistime is a random variablewithan exponentialdist ribution.

De fini t ion2.20Astochast icPetrinet(SPN)is a pairS=(M,d),where:

•M=(N,mo)isa marked net,

•dis a functionwhich,foreachtransit iontET.specifies the rate of the firing delayassociated withit.d:T-+ R+.The firingdela y of a transitiontETisan expone ntiallydistributed randomvariableX,withthera te d(t);the prob ab ility thatthe delayisgreate r than Y. Y>O.is:

Prob(X,>y)

=

e-rod(tl.0

Instochastic nets thefiring dela ysassociated with transitionscanbe markingde- pendent.

Astochastic net has the followingfiri ng behavior:once a transitiontis enabled, the tokens must remainint'sinput places for the time described by the firing delay function.When this time has elapsed,thetokensare removedfrom the inputplacesof thefiringtrans iti on andadded to theout putplaces ofthistran sitio n.

Similarly tobasi cPetr inets , a sta t eofthenet is com plete lydesc ribed bythetoken dis tribut ioninplaces.The statespace ofstochasticnets is therefo re thereachability setof basicPe trinets .

18

(31)

Molloy has shown [241 that dueto theQlemot')..tess property of the exponentialdis- tribution,thereacha bility graph of an SPNis a continuous-timeMarkov chain(16,20).

For ergodic cont inuous-tim e Mark ovchains[i.e.,for Markov chai ns which have a steady- state solution), the steady-sta te probabilit ies can bedeterm ined bysolvinga system of linearequations [34].Thestea dy-stateprobab ilitiescan beusedfor determin ingthe mean numberof tokensin a place,the meannumber ofa transi t ion's firingsinthetime unit,thethro ugh put of a transition. and manyotherproperti es{4,11)_

A popular general izationofstoch asti c Petri nets is known as generalized stochastic Pet ri nets (GSPN).InGSPNs[3.5,13],there are two classes of transitions: trans it ions with exponenti allydistributed firing times(timedtra nsit ions),andtransitions having thefiringdelayequa lto zero (immedi atetrans itions). Thereachability graph of a GSP N is an embeddedMar kov chain {3,4]-

2.3. 2 Tim edPetrinets

In timedPetri nets {39.41.441.the firing of a tcansitionisa non-instantaneousactivity;

the transition starts the firing by removingthe tokens from the in putplaces,it continues thefiring for aspec ified period oftime, and then finis hesthe firing byaddin g tokens tothe outputplaces. The firing ofatransiti on starts as soon asthetra nsitio nis en- abled(althoughsome enabledtransit ions do not start their firingsbecau se of conflicts).

Several concurrentoccurrencesof a transition'sfiring can take placeifthe transition remainsenabledafte r staning a firing.

TimedPetri netswhosetransitionshave deterministicfiringtim es are knownas D-timed Petri nets, whilethose whose transi tionshave exponential ly dist ribu t ed firing timesarecalledM-tim ed Petrinets (Mar koviannets).

19

(32)

2.3.3 M-timedPe trinet s

InM-timed Petri nets (39,41,42,44J,the transitions 'firingtimes are exponentially distributed.random variables.

Definition 2.21 [441AnM-tim edPetri netis a tripleTM=(M, c;f)whe re:

• M=(N,

mol

is a markedPetrinet,

• c:T -+[0,1]is a choicefunct ion whichassignsfree-choice prob ab ilities to free- choiceequivalence classes andrela ti ve frequen cies offiringsto theconflict ingtran- sitions ,

•I :T....R+is the firing-ratefun ct ion,whichassignsthe rate of firings,J(t ),to eachtransi ti on tof thenet.Thefiring time of a transitiontis an exponentially distributed random variableX(t ),wi t htherateI(t );the probabilitythatthe firi ng time isgreaterthan 1/',1/'>0,is:

Pr ob(X(t)>y)

=

e- ,- f( I ).0

Ex ample 2.5Figure2.6showsan M-timed net fortheproblem of threediningphiloso- phers . PlacesA,B,andCreprese nt the for ks,places pl b,p2b,andp3breprese nt,re-- spectively,philosopher"1","2"and"3" want in g to eat,andplaces pla,p2a,andp3a represent the sta te ofa philosopherafter eating.There arethree"ea t" tra ns it io ns and three"thin k"transitions. An"ea t" transition(fo r instance eata) isenabledif both Corksare available andthephiloso phe rishungry(i.e. placesA,Bandplb aremar ked).

Firi ng timesassociated with"ea t"and"think"trans itio ns areexpone nt ially distri buted ran dom varia bleswit h therates 5and3,respectively.0

Astate descriptio nofa timedPetrineemustspecifythe distributi on of tokensover net 'splaces andalso thenumbersof(active ) firings oftransitions.

20

(33)

Figure2.6:Three dining philosophers .

Astate(oran "instantaneousdescript ion" )ofanM-timednetisapairoffun c t ions: a marking function specifyingthedist ribu t ionof tokensinplaces,and a firingfunction which describes thenumbers of the active firin gs ofalltransitions.

Defin i t io n2.2 2 [(4 ) Ast a teof anM-timed PetrinetT,.,-=(M,c.f) isapair 8

= em,

n)where :

• m isa markingfunctio n,m:P-+N,

•nisafiringfunct ion,n:T-+N.wherenet)isthe numberofactivefirings (firings whichhavebeen init.iated but notfinished)oftransition

e.

0

Definition2.23Aninitial state ofanM-timedPe tri netT,.,-

=

(M .c;f)isapair s=(m ,n) where nis a selection functionformo.nESel{mo),andthe markingmis defined as:

.PEP,m(p)~mo(P)-

L

n(t).O IEO.dCJl') AnMe-t imed Petr ine tcanhave se veral initialsta tes .

21

(34)

Examp le2.6 Statesareofte nreprese ntedusing vectornotationforfunct io ns m and n.t.e.•assuming someorderi ngofplacesand transiti ons. Forthis example,theord ering is:

8

=

[A,H,C,pla, plb, p2a , p2b,p3a ,p3b;thin k"thin~,think3,eat"eat 2, eat31.

For the given initial marki ng(placesA,B, C.pl b, p2b, andpJbaremarked,i.e., initiallyallphil osophersarehun gry andallfo r ks areavailable ), there arethree enab led conflict ingtransi t io ns(eatr,eat2,andeat,).butonly oneof the mcan start its firing.

The nethasthus three initialstates:

81=[0, 0,1,0 ,0,0,1,0,1;0,0, 0,1,0, 0),ifeat,isselected tofire,or 82=[1, 0,0,0,1,0,0,0,1;0,0,0,0,1,

01,

ifeah is selected tofire,or 83=[0,1, 0, 0,I,0,1,0, 0;0,0,0,0, 0, IJ,ifeat, is select edtofire.0

Fo r M-timednets the"directreach abili ty" relationis anextension oft hat formarked nets(Sectio n 2.1).

Definition 2.24 (44J LetTM=(M,C,f)be an M-t imedPetrinet. Astate5i

=

(milnilisdir ectlyreachable(or(tk,91)-reach a ble )from a state Si=(711;,nt)iff:

Ln;(t/i:)>0;

2.9'ESd(m ;);

3.'tipEP:m,(p)=~(P)-LIEo..t(p)9,(t );

{ I,ift=t/i:;

4.'titET:nj(t)

=

n;(t)+9j(t)- . 0,ot herwise;

{

I ifpE Out(t/i:), 5.'tipEP:~(P)

=

711;(P)+ '

0, otherwise.0

22

(35)

Statessistransformedinto stateSjwhenoneofthefiring transitions(in this case tl,)endsits firing(1)anddepositstokensintoits out pu t places(5),transformingthe markingm,into amarkin gm',and m'enables new firings,which are describedbythe selectionfunct ion 9/(2, 3,4).

Examp le2.1 ThestateS4=[1,0,0, 0, 0,0,0,0, 1; 1,0,0,0,1,0] is directly reachable fromstateSl

=

[0, 0,1, 0, 0,0, 1, 0,1; 0, 0,0,I,0, OJ; whentransitioneatlendsitsfiring, the token s aredeposite dintoA,8,and pia,thenew marking([1,1,1,1,0,0,1 ,0,1]) enab les transitionthink"whichcan immedi a telystartits firing,and transitionseat2andeats, whichareinconflict,soonlyonecanfire.Therearetwopossible selection funct ions, oneselectingthinklandeat,tofire ,the otherselectingthink\andeats.Ifthe first selection funct ion isused,the next state isS4_0

The relation Si >-+Sj deno tes thatSjisdirectlyreachablefromSi,while Si~Sj indicatesthatSjis (tot,91)-reacbable fromSi'

Asinthecase ofbasicPetrinets,the gene ralreachabilityrelat ionisdefinedasthe reflexive transitive closureofthedirec t reachability relation.

De fini ti o n 2.25 LetTM=(M, c,f)be anM-timed Petrinet.AstateSjis(ge n er- ally)rea chable from a stateSi(Si~Sj)ifthereisa sequenceofsta tess.. ' ...,Si~such thatsio

=

Si,Si.

=

Sj,ands;,isdirectlyreachable froms;,_,forI

=

1, .. .,k.0 Definition2.2 6Thesetofreach a blestates,'R.(7,w)of an M-timednet7101

=

(M,Co/)isthe set ofallstates which are(general ly) reachable from anyinitial stateof 7101.0

Defi niti o n 2.21 [441A stat e graphofanM-timedPetrinetTMisalabeleddirec ted gra phG(TM )=(V,D,h,q)where:

Visasetofvertices,V='R.(TM

=

(M,c,f)), 23

(36)

Disaset ofdirectedarcs:D={(s;, s/ )

I

s.,sjEVASi...Sj},

h isanod e labelingfuncti on,h: V-+R+,whichspecifiestheaverag e holding timesof states:

"Is

=

(m,n)ES:h(s)

=

If~f(t)•n(t),

•qisan arcla beling functi on , q:D--+[0, II,whichassignstheprob abilityof state transit ionfromSi=(m;,n;)toslto each arc(Si'sl) 'whereslis(t k,9d~reachable fro mSo;q(s;,Sj)=

1 • l'

whe re

1

istheprobabilitythatt.term inatesits firing instate"'i:

q

=

E:·~;l~ti~t)'

andq"istheprobability of the selection9/after-theendofthe firing of

t.,

l'=q(m;..,g, )wherem;..isthemarkingofthenetafter the endoftt 'Sfiring:

{

m;(P)+1, if p EOu t(tt ), Vp EP:m;,.(P)

=

m;(P), othe rwise;

andq(m;,,t,gl)is theprobabilityof thenodecorresponding to 91inthe selection graphform;,.l: (Section2.1.3).0

Asta te graphof anM- t imed net isacontio.uous-timeMar kovchain whose sta tio na ry probabilities ofstates,:t"(s ),SE'R.(Tu),are determi nedfrom thesetofequilibrium equations(44]:

{

EI$.i~K

q(Sj , Si):t"(sJ)fh(sj )=z(s; )fh(si);i=1, ...,K-1;

EI9~KX(Si)=1;

whereKisthenumbe rofreach a b le states.

Ma nyperforma nce measures can be derivedfromthese probabilities144].

Example 2.8 Ta ble 2.1showsthest ate space of thenet shown in Figure2.6.0

2.

(37)

Table 2.1:Statespace(0["thenetinFigure 2.6.

,

min h, next sta tes treastetcn pro b.

"

0,0, l,O,O,O,l,O,liO,0,0,I,O, O!

z.c

··{S4'SS \~5.a.~!

s,

(1,0, 0, 0, L,O,0,0,i.o,0,0,0,I,OJ

a.o

{Sl,Sr}

[o.s.o.s]

s [0,1,0,0,1,0,I,D,0iO,0,0,0,0,I)

ao

{S8'Sg}

(o.s.o.sj

'.

[1,0,0,0,0,0,0,0,Ii1,0,0,0,1,0) 1.42 {S2,SIO}

[o .es.o.n]

'.

[0, 1,0,0, 0, 0, I,0,

o,

I, 0,0,0,0,I) 1.42 {S3' SU} {0.29,O.71}

s [0,0,1, 0,0,0,0,0,i.o,1,0,1,0,0] 1.42 {Stts\o} (a.29.a.7l} sr [0,1,0, 1, 0, 0,a,0, 0;0,1,0,0,0,I] 1.42 {S3,SI2} (a.29.a.7l}

'.

[0,0,1,0, 0,0, 1, 0, 0; 0,0 ,I,1,0,0] 1.42 {Sb Sn}

[o .zs.o.n }

s,

(1,0,0,0,1,0,0,0,0;0,0,1,0,1, 0]1.42 {S2,SI2} (a.29.a.7l}

sre [0,1,0,0,0,0,0,0,0;I,I,D,0, 0,I] 1.11 {S7,SS,SI3} {0.22,0.22, 0.56}

su [1,0,0, 0,0,0,0,0,0;1,0 ,1 ,0,1 ,OJ 1.11 {S9, $4,$t3} {O.22, 0.22 ,0.56}

:;: I f~:~: ~: ~:~:ri: ~:~: ~~~: ~: ~:ri :ri:~l

1.111.66

(~::::~;~;~!l I lg ~: g~: g ~;

2.3 .4 D-timedPet r i nets

InD-timedPetrinets(40,44J,thetransitions'firingtimesareconstant(posit ivereal numbers).

De fini ti o n 2.28 [44] AD-t imedPet r i net is atripleTo=(M,c.f)where:

•M

=

(N,molisa mar kedPetrinet,

c:T~[0,1]isachoice func tion whichassignsfree-choice probabilities to free- choiceequivalenceclassesand relativefrequencies of firingstothe conflictin grran- sitions,

•J;T~R+ isafiri ng-time fu nctionwhichassigne thefiring timeJ(t )toeach transit iontET.0

BecauseD-t imednets donothave the memorylessproperty,inadd ition to thetoken distribut ion overplaces ofthe netandthenumber offiringsoftransit ions,a state of

25

(38)

aD--timed net must also specify therem aini ng-firin g-t im eforeachoccurrence ofeach acetvetransition.

Definiti o n 2.29 [44J Astateof a D-timed Petri netToisatriples=(m, n,r) where;

•misamarkin g funct ion,m;P-+N,

• n is afiringfunction(asforM-timednets), n T-+N,

•ris a remaining-tiring-time funct ionr :T0-+N>-+ R+,which assigns the remain - ing firingtimeto each independ entfiring(ifany) ofeach trans ition. Funct io n rispartial;if net)=k and k>0,thenret)isa vectorof k nonnegative non- decreasingrealnum be rs denoted byr(t )[l l,r(t)[2j, ...,r(t)(kliifnet)=0,ret )is undefined.0

De fi n ition 2.30 (441Aninitialstatesof a D-timedPetrinetTo

=

(M, c./)isa triples=(m;,n;, ri)where:

•m;is amarking (unction ,

Yp

e

P,m;(P)~m,,(P)-

L:

n;(t),

IEOut(p)

• n;isaselect ion functionofmo,n;ESel(mo),

• rs isarem ai nin g-firing-t ime functiondefined as:

{

J(t ), ifn;(t)>0and1::5k::5n;(t );

YteT,r,(t >lk)

=

undefined, ot he rwise. 0

A D-timedPetrinet can ha ve severa l init ial states.

Definiti on 2.3 1 (441LetTo

=

(M,c.f)be a D-timed Petrine t . A sta te5i

=

(mi' njori)isdirectly reach ab le(o r 9,,-reachable) fro m a stateSi

=

(m;,n"r,)iffthe followin g conditions aresatisfied:

26

(39)

1.gt ESd (mi)i

3.

ve

ET:nj (t)= no(t) - d,(t)+gt(t );

{

,.(. )(/+<I, (' ))-h" ifl';/ '; " (' ) - <1,(' );

4.'VtET:rj (t )[I]=

f(t), if no(t) -d,(t)<I:5nj (t) ; where:

5.'VpEP:~(P)=m.;(P)+EI€ / ..p{p)d,;(t) ;

{

e, ifno(t)

~

zandr;(t)[ l ]

=

hifor 1:5l:5a, 6.Vt E T:d,;( t)

=

0,ot he rwise;

7.h;=IET~&l>O (ri(t)[lJ).0

The ge neral reacha bili tyrelat io nbetween states andthe set of rea:.cbab le sta tes 'R.(()To )aredefinedina similarman ner asfor M-timedne ts.

Defini ti o n 2.3 2 (44) Astate grap hofaD-timed.Petri netis a labeleddirected graphG(To)

=

(V,D,h,q )where:

•Visthe setofvertices,V

=

'R(To),

h is a node labeling function,h:V-+R+,which specifies the holdingtimesof states:

V$i=(m;,no, r;)ES :h(Si )

=

min (r i( t)[tJ), lET...;(r ) i!:O

•qisan arcla belingfuncti o n, q :D-+[0,11,which assigns thepsroba hillt y of transitionfromSito sJ toeach arc (s; , Sj )where 8jis 9t·reacha ble fromSi:

q{S;,S j )=q( m ' , 9t )

27

(40)

andm' isthemarking aftertheterminat ion ofthefirings withthe smallest remain- ing firingtime(as determinedinDefinit io n 2.31),andq(m',91,)isthe probability of the node correspondi ngto 911:intheselectiongraphfor m'.0

Example2.9 Forthene t showninFigure 2.1with firingtimesI(tl)

=

1,l(t2)

=

I(h )

=

0.5,andl(t4)

=

2.5, theonlyiniti al stateisSo

=

[0,0,0,1,2,0;1, 0,0,0;1,0, 0,0].

The reach ab ilit ysetofthe net is shown in Table 2.2.The netis conflict-free,sothere is onlyone next state for each rea cha ble state.

a

Table2.2:Sta t espac eforthe net inFigure 2.1.

S m; n; r hs next state transitionpr ub.

s, !~,0, 0, 2, 2, 0; 1,0 ,0 ,0 ; 1,0,0,01. 1.0 s, 1.0

s, (0,0 , 0, 1, 1, 0; 0,1,0,0 ;0,0.5,0,0) O.S s, 1.0

s, [0,0,0,0,1,0 ; 1,0,1,0; I, O,O.S,Oj O.S s, 1.0

s, [0, 0, 0, 0,2, 0; 1,0,0,1 ; 0.5,0,0 ,2 .5] O.S ss 1.0

s, [0, 0, 0,0,1,0; 0,1,0,1; 0,0.5,0,21 O.S s, 1.0

ss [0, 0, 0, 0, 1,1; 1,0,0,1; 1,0,0,1.5] 1.0 s, 1.0

s, [0,0,0,0,0, 1; 0, 1,0,1; 0,0.5,0, 0.5J O.S s, 1.0 s, [0, 0,0,0,0,1; 1,0, 1,0; 1, 0, 0.5, 0] O.S s, 1.0 s, [0,0, 0, 0, 1,1; 1,0 ,0 ,1 ; 0.5,0,0,2.5] O.S s" 1.0 ere [0,0, 0,0,0,Ii 0,1,0 , 1; O,O.5 ,0 ,2J 1.0 su 1.0 sn [0,0,0,0,0,2;1, 0,0 ,I; 1,0, 0, 1.5] 0.5 au 1.0 s" (1, 0, 0,0,0,2; 0,0 ,0 ,1; 0,0,0, 0.5] 0.5 Su 1.0 s" (1,0,0,0,0,1; 0,0,1,0; 0,0,0.5,0] 0.5 s" 1.0

s.. [0, 0, 0,0,0,1; 0,1,0,1; 0,0.5 ,0,2.5) 0.5 sis 1.0

:: : I f~: ~:~: g : 6:~:

1,0,0,1;0,0,0,1;

~:g:g: il

1.01.0

'"

S" 1.01.0

The state graph of a Iree-chclceD-t imed netisa discrete-time discrete-st atesemi- Mar kov process(16]whose embeddedstationaryprobabi lit iesy(s) , sE'R.(Tv ),are dete rm inedby solvi ng asystem oflinearequation s[441:

{

El$i SKq(s;,

s~ ~

yes;);i

=

1, ..,K- 1;

LISt SKyes;)-1, 28

(41)

ThestatioD.aryprobabilitiesofsta tes, zo(..),,,E R{IO),are determinedfromthe embedded.stationary probabilities[44]:

"18E'R.(ID);ZO(8;)=y(s;) .h(s;)f

L

Y(SJ).h(Sj).

L:SJ:SK whereKis thenumberofstatesin thereachabilityset'R(/ D).

Detailedinformationon timedPet rinets,their analysis andapplications can be foundin[39,40,41,42,441_Asoftware package,TPN-tools[381,hasbeen developed fortheanalysis oftimedPet ri nets.

2.4 Distributed state space generation for st ochas- tic P etri nets

Statespace genera tionfor ne ts withlarge num be rs of statesis adifficult task because of thelargememory requirements . This im ped iment can beavoidedby usingthe (combined) memory availabl eina clusterofcompu ters. Researchinthisdirect ion hasbeen conductedintbe las tfew years[8,6, 7,9,19, 21,23, 28, 3OJ. Mostof theauthors emphas ize thatthemain advantageof thedist ributedalgorith misthe possib ilityof generatingstatespaces whichwere toolar geforthe memoryofa single worksta tion.However, such an approachintrod ucesacommu nicati on overheadindu ced bythenecessarycoordinationbetweenthe processes cooperatinginthedistri buted algorithm.

This sectionreviews severalaspectsof dis tributedstate space genera tio n for sto- chastic Pet ri nets.

29

(42)

2.4.1 General framewor k

Anatucal approach to distributedstate space gene rationisto use a"di vid eand conquer"

technique,i.e.,to construct disjointstate subgraphsondifferent computers,and then integrate themtoobtaintheent ire state graph.

Requirement s: Inordertominimize tbecommunicationoverhead andto achievea good speedup,a distributed algorithmforsta.te space generationshould satisfy(a t least) the followingrequir ements:balance(thestates should be equally distrib utedamong processors,called spat ial balance(or memo ry balance) ,andall processors shouldbe busyalmostallthetime , calledtemporalbalance ) andlocali ty(whenever poss ib le, a successor st ateshouldbe process edby thesameprocessor asitsparentstate ).

Generalapproach: Thereach ab ility gra phispartit io ned intodisjointregio ns which are const ructedseparately ondifferen t processo rs.Thispartitioning shouldbe done in such a waytha t allprocessorsare assigned approxi ma te ly the samenumberofstates.

However ,it is rather difficultto determinea mechanism to do such a partitioning withoutknowingthestatespace.

The algorithmusedbyeachprocessor isbased on the sequentialalgorithm,butsome addi t ional aspects mustbe takeninto consideration.

Thefirst modificationtothe sequentialalgorithmisrelatedtotheinitial state (the re is only one initial state forstoch as tic nets).Eachprocessis providedwith thesame initi al state,but onlytheprocess which is responsibleforit adds this initialstateto theworking listunezplored.

Secondly,when astate is gene ra ted.itmustbedecidedwheth erit hasalreadybeen generated earlieror not(Le.,whetheritisa newstate or not ).Thisquest ion can beanswered iftheprocessorwhichprocesses thisstateisknown.Thisleads to the

30

(43)

ideaofdefining apartit ionin gmechanism (partitioningfuncti on)whichcanbe used byallprocessorsinordertode te rm in e the processorresp onsiblefor a statewlthO'Ut additio nal commWlication.Inot herwords, thesta tespaceis "split"intoregi onsbefo re the computation.

When ever a processor generatesanew st a te,itchecks,usingthe partition ingmech- anis m,whet her the stateislocal ornot .Ifthesta t eislocal(whichis thedesiredcase, acco rdi ngtothelocalityrequir ement,sothatthe com m u n ica t ionisminimized)then lin es 19- 27in the followi ngalgorith m are executed.Oth erwise the st ateissenttothe processor responsible foritsfurtherproc ess ing.

The thirdimpo rtantissueistha t theterminat io n condi t ionfrom theseque nt ial al- gorith misnot sufficient anym ore: theprocesscannot termin ate when its queueofunex - ploredstatesisempty,becauseitcan stillreceive states gen eratedbyoth erprocessors.

Ther efo re,aglobal termina t iondetectionmethodisneed ed. Dijkst ra's"circu lat in g probe"[15]isused in[19,301.In[231terminationisdet ec ted usingbar ri ersynchro- nizati o n.In[281theauthorsuse the non- commit t albar r iersynchro nizationalgori t hm [29J.

Ingeneral,all processorsfollo wthealgorithmgivenbelow. Itisassu medth a t upo n th edetec t io n ofthe glo bal termination ,a "tenninat ion messag e"is senttoallprocesses engaged.inthe computation.

1.algoritblDdistributed..state-'l~eneratioD;

2.var31);

3. lItates: = I;

4. ar a :=

e;

5. lIearch-llet:=t'l; 6. unexplored:=0;

7. extern-lltate":=0;

8. thill..pr oce llll..id :=proceJlll.id(pr ocellsor );

9.begin

10. Ifpartition (so)=thill..proces lLidthen 11. "ta ull:=statesU(,,0};

31

(44)

12. insert(.lIearch ....set•.1(1); 13. insert(unexpl or ed, .so) 14. endi£;

15. whilenot-recri ved ...termination...mu.sagedo 16. whiletWr'lefl1.ptl/{unexplored")do 17. .s:= remove(unezplored");

18. fo rall¥E.uoc::u.sor(.s}do 19. ifpartition' ¥)'Fthi3...proce u.idtben 20. .lIend ....date(" .pa.-tttiorl.(3' ));

21. 3end ..arc(.s,s). po:rtition(.r'»)

22. else

23. if.s'~.lIe4 rch ....settben

24. .lItate3:=3w.~$ U {$'};

25. iR.'lert(lIe4 rch....set, s');

26. irnlert(u~ored, r')

27. en di f;

28. arc.s:=arCJIU {(s,.lI')}

29. en d if

30. endfor

31. endwhile;

32. extern....state$ :_rece1ve....states-state.'!; 33. state.'!:=state.sUextern_d a te.'!;

34. arc.r=arcsUreceive..arc.s;

35. forall$"Eextern....state.lldo

36. insert(unexplored• .'!" )

31. end for

38. end w h ile 39.end.

Lines 32and34 from the above algori thm descri bethereceiving ofstatesandcor- respo nd ing arcs from otherprocessors,andtheirintegratio nintothe currentprocessor data st ruct ures. Thenewexternalstates(Le.•states whichdonot belongalready to theset st ates)are inserted inthereachabilitygraph. .""-'1thearcs areadd ed tothe set

Architecture: In thedist ributedapproach,thestatespac eisgeneratedby several processorsperformi ngthe same algorit hm.In [30]severalprocessesfollowi ngtheabove algorithm are used. The state spaceispartitioned into class es. Eachprocesso r is assigned anumb er of classes.Thesear chdata structure, searc h..s et,consistsofseveral

32

(45)

sear ch trees,one per class.

Additionall y, a central processorcanbe usedtoprovide globalcoordinat ion. A master-slave architec tu re is usedin

{7J.

Theslavepr0ce5S0IS are organ izedin a chain andthey actually construct the rea.chab ilitygraph.Eachof the sla.veprocessors uses a balancedsearchtreeas the search structure.The masterprocessorcontrols the process of load balan cing.

Partitioningmechanism: Apartit ioning mechanismmust ens ure a uniform dlsrri- hutionofstates .A partitioningmechanismwhich does notdistribu te thesta tesevenly among processorscanhavetwo negat iveconsequences:(a)ifa processorisassignedtoo many states toprocess itmayrun outofmemory andtheentire computationwillsto p;

(b) uneven distrib uti on ofstates can resultin lar ge differencesinexecut iontimes,and, therefore, low speedup.

Moreover,thelocality aod thememorybalance of themeth oddependonthe chosen partitioningmechanism:

• locality can be achievedifthe partitioningmechanism ma ps the SUCCeiSQrstates onthesame processo rastheir parentstates;

•balance canhe achievedifthe partitioning mechanism uniformly distributesthe states amongprocessors.This is highlymodel-dependent and especially difficult becausethe statespace is notknown in advance, SO the strategyof partitioning canonly bebased00structuralpropertiesofthemod el.

HashFunction: Afirstchoice forthepar titioning mech anis mis a hash funct ion [23, 30]. Thisfunct io ntypicallydependson a (well chosen ) set of places of the Petri net , C= {Pt,P2, ..,PICI},C~P,calledcontrol set. The gen er alform ofthehash functionis [23):

33

(46)

101

partition(m)=(~Ojm(pi» mod (n).

Intheformula above,n is the num b erofprocessors,m is amar kingfunction(or thestate in thiscase),and the coefficie ntsCG areint eger(p ri me ) numberswhichare determinedexpe rim entallyforthe analyzed net.

The efficiencyofthe hashfunction depe ndson theselection ofthecont rol set C and thecoefficie ntsOJ.

Findi ng a goodhashfunction ,which ensures auniformdistributi o n ofst atesamon g processors,requ ires someknowledgeof the model.This is whythereis no generalrule onhow ahas hfunct ion shouldbedetermined.

Balanced search tree: A methodtoauto ma ticallyconstruct a partitioningmecha- nism is given in[28].Thestatespace ispartit io ned into classes . Each classis assigned toa processo rbuta processor can have severalclassesassignedtoit.The classesare implemen tedas balancedsearchtrees.Class0(act ually,the correspondingbalanced tree) isused asa partitioning mechan ism.It willresideon all pro cesso rs.

In orderto de te rm inethe class of a sta te,thetree is search ed.Ifthest ate isfound, thenitbelongstoclass o. Otherwise,the terminalnod e(and, implicitly,theclass) is determined where the stateshould be inserted.Fora given sizeof theclass0,this tree is"a utoma tical ly"constructedbeforethestatespacegenerationstarts:all processors generatea"ran d o m walk"thro ug h thestate space determining aset ofsta tes . Then these setsofstates are combinedinto thebalanced searchtree. Wit hou tgoing into furtherdetail s , thisrequires communica tio n andcooperatio n. Thisprocess isnotfully automa tedbecauseexperime ntalwork is stillnecessaryin orde r to determine the best sizeof classO.

34

(47)

The advantage of such a mechanism overa hash funct ionisthatitis (partially)au- tomaticall y constructed,and itdoesnot require(much) model-dependentinforma tio n.

However,the process ofconstructing this partitioningmechanismisrather com plicated.

Remapping of sta testopro cessors: Becauseit is very difficulttodefine agood partitio nin g mechanism,memory imbal ancescanbe amelio ratedbychangingthestate assignm ent to processo rs.This opera ti o niscalled.remapping.

Thefollowi ng"mixed" approachhas beenfound succ essful[8, 281:a partit ion in g functionis defined.and used. during thesta te space generation.However,from tim e totime,the mem o ry usage of eachprocessor is checked.Ifla rge differencesare found, a rema pping process isinitiatedandsomestatesfrom "overload ed"processo rs are reassi gn edto"unde rloaded" process ors.

Remappingcan be donefor differe nt purpos es: for achievin gmemorybalance , or to prevent overloaded processorsfrom the danger of exhaustingthe irmemory(m e m o ry- balance- orientedremapping) or to improvetheexecutiontime(tem po ral - b al ance- orient edre m a p p ing).

In[28Jremapping isdo neby reassigningwhole classes to different processo rs.Two rem appi ng st rategiesarepro posed;one is an at te m ptto balancememo ryut ilisation, and theotherisan attem pttominimizethe execut tc ntime.Thedatatransferisdone bet weenprocessorswith highload differe nces,i.e.,overloaded processorssendda ta to underloaded.processors.

A different approachisusedin[8J. The master processchecks theslave workloa ds fromtimeto time.Incase ofdifferences in memory utilizationhigherthan some prede- terminedvalue,aload balancingisinit iat ed , butthe da ta are transferredonlybetwee n neighb orin gprocesso rs (a chai n topol ogyis used).

35

(48)

2.4.2 Conclusions

.4...lJ.the distributedapproachestostate spacegenerationuseapartitio ning mech anis m which dividesthe state spacebefore generating it.

Thedistributed versionsofalgorithms bring animportantben efitovertheirsequen- tialcounterparts : theycanhandlelargenets whose memory requir ementsareunm an- ageablefor a singlecomput er. The irperformance (memory balance,executiontime, speedup},however, isinfluencedbythe(st atic) partitioningmechanism employed.This influencecan be reducedifthe partitioningmechanismcan be modified at run-time, accordi ng to thecurrent workloaddistribut ionamongtheprocessors. Forthispurpose, somealgorithmsuse dynami cloaddis tributingtechniques,impr ovingtheperfor man ce.

36

(49)

Chapter 3

Distributed s t a t e space generation for timed Petri nets

Thischapterdescribesa distrib utedalgorit hm forthe genera tio nofthesta tegraph of time d Petrinets.

Section 3.1 out linesthemet hodused.Secti on3.2describ esthetem poralorganiza- tionofthesystem.Section3.3presentsthe top-leve l design of the distributedsystem (the components'funct ions andinte r-ecmponent cooperation ).Finally,Section 3.4 de- scribes each componentindetailwith PVM-pseudo-eo dealgo rithms.

3.1 Gene r al consideratio n s

LetT=(M,c,f)beatimedPet rinet,whereM

=

(N.

mol

isamarked Petrinet. The sta te graphofTcanbegen eratedusing a"divideand conquer" technique as fol- lows:the (yet unknown) statespaceispartitionedinto n disjoint regions Rl.R2 •"',R.,.

whichare constructedindependently,andthenintegratedinonesta te graphifneeded.

Theconstru ction oftheseregionscanbe distributed to nid ent ical processes running concurrent lyon different machines. The entire distrib utedgeneration has threephases:

L theiniti alizationphaseduringwhichthesys te mis setup bycreatingthe co- operat ing processes and exchan ging the inform a tio nnecessary forinter-process

37

(50)

co mmunicat ion ,

2.thecomputationalphtUJe duringwhich theregions of the statespace are con- strutted,

3. the(o pti o nal)integro.tI'onpha..se,during whichellthe statesand arcsoftheregions are collec ted,and integrat edinto thecompletestate graph.

Thisappro achrequiresthe exist en ce ofth ree kinds of logi calprocesses(as shownin Figu re3.l):aprocess startingthedistri b utedsystem andin itiatingthecomp utat ions, calledSpawner;severalpro cesses cons t ruct ingthe regi onsgra phs,calledGen erotor3, and apro cesscollecting andintegratingtheresults,calledCollector1. Sec tio n3.3.3 discussesthemess ages exc hangedbetween theseprocesses.

Figu re 3.1:Distri buted. gen era tionsystem3 processo rs.

Phys icalprocesses correspondi ngtotheselogicalpre cesses constitu tea "virtual machin e."Thisvirtualmachinerunson a clusterof computers.

State gra p h partitioning

Thefirstpr oblemistodeter min e,foragive nnet,thedisjo in tre gi ons inwhichthe (notyetconstruct ed) stategrap hsh oul d be pa rt ition ed.Thesolut io nis a partiti oni ng ITechnical l}', as a pro«SS, theCollec t or canbethesame&!ItheSpawner, because theyexistin disjo int periodsoftime ,the SpaW1ler perionnsthe initializationphase,whilethe Calleetor works in the integr ation phase.Thedilitinction bet weentbe millmad eforclarity only.

38

(51)

mechan ism.residing oneachprocessor.which determines,foreachstate,theregionto whichit belongs.Inthisway all processorsareawar e ofthe structureof thispart ition.

This mechanism isa hashfunction whichassignsstatestoprocesso rs accordingto thedist ribution oftokensinplacesandthe numbers of firing trans it ions:

partition:"R(T)-+{l•...n},

'" IT1

partition(s)=(~Q'm(p;)+

?;

(J;1(4 ))mod(n).

where thecoefficientso, and{J;areintegernumbe rsands=(m,I.r) if

r

isa0- timednet(Sect ion2.3.4).ors=(m, f)if

r

isan M·t im ed net(Section2.3.3).This functi onimplicitlypartitionsthe graphinto nregionsR1 , •••R..suchtha tfor each regionR.;=(S tates.,Arcs; ):

States;

=

(s

I

sER(T)I\partition (s)=i}

and

ArC6;

=

{(s, s')ls'States.}.

Thepart iti onin g functionissimilar to theone used in(231,wit hthedifferencethat thecomponentsofthestatecorres pond ingtothe firingtrans itio ns are also ta keninto account fordeterm iningtheregionofthe state.

ProcessGener ator;is responsiblefor thesta tesin regionR.;andfor thearcs directed tothesestates.Pract icall y,ifaGeneratorisrespo nsibleforasta te.it deter m ines its successors.Asuccessor statecan beinthesameregion(inthis casethe connecting arc is aninternal arc)orin adifferentregion(in whichcasethe connectingarc is called acr o as-arc).

3.2 System temporal organization

The distributedgenerationofthe sta tespaceiscom posed of thefollowingsteps;

39

(52)

1.Systemstartup(Section 3.2.1),which includes:

(a)set ting up thevirtual machine(i.e., starting allprocesses of thedist ributed.

system);

(b)providi ngall processo rswiththe add ressesofthe processes they needto interactwith.

2.Computationalphase(Sect ion 3.2.2),which includes:

(a) generation ofallthe states and aresstarting from theinitialsta tes;this includessendingstatestotheirappro priateprocessors;

(b) transferofremaining cross- ar cs totheprocessors resp onsible for them.

3. Resultintegration(Sect ion3.2.3) .

3.2 .1 Sy s t em startu p

Duringthe startup phase, all processesare created,and they exchange the informa tion that is needed forcoopera tive constructionofthesta te graph.

Theprogrambas two inputfiles:onecontainingthe n+1 availab lehosts and the othercontai ningthe Petrinetdescri ption.

Thedistribu tedstate space generationstarts withtheexecutionoftheSpawner.The SpawnercreatestheCollectorandspawnsnGeneratorson theother hosts,providing them with the addresses ofitse lf and of theColled or,sotha tthey can directmessages tothem.

The communicationaddress of eachGen eratormustbeknowntoall processeswhich wan t to send thatGenerat ormessa ges, i.e., theSpaumer andotherGenerator.!.For this purpose ,each Generatorsendsits comm un icat ionaddressbacktotheSpawneras soou

40

(53)

asitisready.TheSpawner collectsalladdresses into theprocess table,andbroadcas ts itbacktoallGeneroton.

3.2.2 Cons t ruc tionofthestatesubgraphs

The st ategraphis constructedin a mann ersimilartothe sequentialalgorithmdescribed in Section 2.2.1,withsomedifferences duetothe wor klo addist ributed amongaset of processo rs.

Astate 8 crea ted byGenerator;islocal to itifGenerator;isrespons ibl efors, andit isnon-localotherwise.A states is exte rnaltoGenerator;ifGenerator;is respo ns ible fors,bu tshas been createdby anotherGenerator.Anon-local statecan be generated many times byGenerators.Non-local states generatedfor the first-time are calledfirst-ti.me non-localstates,andthe corresponding cross-arcs directed to themare calledfirst-timecross-arcs.

Because aGenemtor is responsibleonly for the states in one region of thegraph, it sendsallnon-loca lstateswith the app ropria tecross-arcsto theappropriateGenerotors.

Also,eachGenera t ormus t be abletoreceive thestatesandarcs sent to it . The refore, eachGen eratormusthaveprimi tives tosendandrec eivemessages.In orde rtobeable to send messages directlyto otherGenerators,the processesmust know eachother's communicationaddresses. Allnecessaryaddresses are keptin aprocesstable, which is an arrayof processid e nt ifie rs.

When an externalstate does not already existinthe region ofthe destinationproces- sor,it isinserted thereand then processed.External cross-arcs are treated differently because theinsertionof cross-arcsint otheir approp ria teregio ns is notcritical forthe state spacegeneration. Thisleads to theideatha t the sendingthecross-arcsto theGen- eratorsrespo nsible forthemcanbepostponed tothemome ntwhenallthe st a t es have beengeneratedinallregions red ucingthe communica ti onduring thestategene ration

41

Références

Documents relatifs

A Distributed Monitoring Protocol Section III defined the semantics (i.e., the final state) of an observed timed event sequence.. Section IV showed how this semantics can be computed

The executions of wellformed ITPNs with zero duration and autoconcurrency under maximal step semantics are given by the so called firing step sequence as defined in [8], where a

The paper is organized as follows: First formal definitions of ITPNs and their maximal step semantics are given in Section 2, and some semantical equivalence is proved. Then

Timed Petri nets (TPN) or Duration Petri nets (DPN) is a well-know approach to extend “classic” Petri nets in order to allow the modeling of time [1].. In [2], a state equation for

In this paper, we propose a symmetry reduction method for a state space abstraction technique for real-time models with dense time semantics, the State Class Graph (SCG)

Sometimes, the immediate successor of a given state (which is equivalent to fire a transition) can only be constructed with help of added tokens with appropriate values in

We show that it is possible to extend the state class construction to this new extension, which gives an efficient method for computing the intersection of two TPN when the nets

For an alphabet of size at least 3, the average time complexity, for the uniform distribution over the sets X of Set n,m , of the construction of the accessible and