1. Trang chủ
  2. » Thể loại khác

DSpace at VNU: Shift-Left Algorithms transforming sequential processes into concurrent ones

10 86 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 10
Dung lượng 3,78 MB

Nội dung

DSpace at VNU: Shift-Left Algorithms transforming sequential processes into concurrent ones tài liệu, giáo án, bài giảng...

VNU JOURNAL O F S C IEN C E, Mathematics - Physics, T.XXII, N q2, 2006 “SHIFT-LEFT” ALGORITHMS TRANSFORMING SEQUENTIAL PROCESSES INTO CONCURRENT ONES H oang Chi T hanh H anoi U niversity o f Science, V N U H Abstract Finding concurrent processes of a system is an objective of system controls, because it shows an optimal way to perform processes In this paper we build two iterative algorithms for transforming sequential processes of a reliance alphabet and of a Place/Transition net into concurrent ones The complexity of these algorithms is also considered K eyw ords: Reliance alphabet, trace, Petri net, concurrent step INTRO DUCTIO N C ontrols on c o n c u rre n t system s alw ays a re a n im p o rta n t a n d com plicated problem So far, o p tim al perform ance of processes occurred on a c o n c u rre n t system is am ong th e controls F o r th is purpose, recognition of c o n c u rre n t processes of th e system is e sse n tia l A lo t of m odels, such as P e tri n e ts [6,9], tra c e s [1,3,4, 8], CSP [7], CCS [5], process a lg e b s [2] have been b ein g good tools for rep re se n tin g s ta tistic a l as w ell as d y n am ical stru c tu re of system s From th e s e m odels, seq u en tial processes of a system a re n o t difficult to recognize b u t c o n c u rre n t ones still are T herefore, how to tra n sfo rm seq u en tial processes of a sy stem onto c o n cu rren t ones is a g re a t problem on th e o ry and application indeed A sim ple alg o rith m for finding th e norm al form of tra c e s is a good solution for system s re p re se n te d by relian c e alp h ab et P la ce /T ran sitio n n e t is one of su itab le m odels to re p re s e n t c o n c u rre n t system s B ut th e lan g u a g e g e n e te d by a P/T n e t is seq u en tial I t show s u s only seq u en tial perform ances of th e n e t’s processes So w hen sev eral tra n s itio n s c an be perform ed co n cu rren tly W e w ill co n ce n tra te on building a n ite tiv e a lg o rith m for tran sfo rm in g s e q u e n tia l p ro cesses of a P/T n e t into c o n cu rren t ones T his p a p e r is o rg an ized as follows Section c o n stru c ts a “sh ift-le ft” algorithm for finding th e n o rm al form of a trace In Section we propose th e n o tatio n of concurrency in P/T n e ts Section builds up a n ite tiv e a lg o rith m for finding sequences of m axim al c o n c u rre n t step s on a P la c e /T n sitio n n e t from th e n e t’s sequence of single steps F in ally , some conclusions a re given in S ection N orm al fo rm o f tr a c e a n d its fin d in g T he th e o ry of tra c e s w as o rig in ated by A M arzu rk iew icz in [4] a s an a tte m p t to provide a good m a th e m a tic a l description of th e b e h a v io u r of c o n c u rre n t system s T he n o rm al form of a tra c e gives a n optim al way to p erform a p ro cess re p re se n te d 55 H oang Chi T hanh 56 by th e trace In th is section we will c o n stru ct a sim ple ite tiv e alg o rith m for finding th e n o rm al form of a trace 2.1 In depen den ce re la tio n a n d traces D e f in itio n 2.1: L et E be an alp h ab et A n independence relation over z is a sy m m etric a n d irreflexive b in a ry relatio n over z A reliance a lp h a b et is a couple c = (E, I), w here E is an a lp h a b e t and I is an independence re la tio n over s C onsidering a d ja ce n t in d ep e n d en t sym bols in a s trin g to be com m uting, one can re la te d ifferen t strin g s as follow D e f in itio n 2.2: L et c = (Z, I) be a reliance a lp h a b e t The relation =c c= Z*xZ* is defined as follow: for X, y e E*, X =c y if and only if there exist Xj, x € E* and (a,6) € I such that X = x j a b x and y = x j b a x 2 The C -equivalence relation =c c is defined a s th e le a s t equivalence relatio n over E* co n ta in in g = c T hus, =c id en tifies ‘com m utatively sim ila r’ s trin g s — each such group of strin g s is called a trace D e f in itio n 2.3: L et c = (£, I) be a reliance a lp h a b e t For an X e E*, t h e t r a c e o f X, denoted by [x]c , is the equivalence class of containing X =c A tr a c e over c is a set t of strings over E such th at t = [*]c for some X e £* and X is called a representative of t A set of tra c e s over c is called a trace language over c E x a m p le 2.4: L et c = (E, I) be th e reliance a lp h a b e t given by th e u n d irected g rap h in Fig a b c d The trace t of abcecd = [abcecd]c = {abcecd, bacecd, acbecd, abeccdy abcced, abcedcy baeccd, bacced, bacedc, acebcd, acbced, acbedc, aebccd, abecde, abccdel 2.2 N o rm a l form o f tra ces One can define a com position operation on tra c e lan g u ag e “S h itf-left” a lg o r ith m s tr a n sfo r m in g seq u en tia l p rocesses 57 D e f in i t io n 2.5: L et c —(£, I) be a reliance a lp h a b e t F o r tra c e s t h t2 over c , the trace com position of tj a n d t2, denoted by t,.t2, is defined by t , t = [Xj.x2]c> where Xj, x € £* are representatives of tỵ and t respectively In g en eral, a tra c e can be o b tain ed as a trac e com position of o th e r traces b u t trace decom positions of th e given trace not h ave to be unique Hence it is d esirab le to h a v e ‘n o rm al form ’ decom position of traces D e f in i t io n 2.6: L et c = (£, I) be a reliance a lp h a b e t a n d / be a trace over c The following decom position t = t,.t2 □ tm, such th a t: for a ll s i s m, £, * ; for all < i < m , t, can be w ritten as [«;], where Uị G £*, #a(u,)=l for each a e alph(u,), and (a ,b ) e I for a ll a, b e alph(Uj) such th a t a # b ; an d for a ll s ỉ' s m -1, if Í, = [Uj] and tUj = [ui+1] th e n , for each a e a lp h ( u 1+i), there exists b e alph(ii(), such that (a , b ) Ể I; is called the normal form of the trace t In [ ] J I A a lb e rsb e rg an d G Rozenberg poin ted o u t th a t every trace can be uniquely decom posed in to a n o rm al form, i.e a m in im al n u m b er of ‘m axim al in d ep en d en t p a rts T hey h a v e b u ilt two algorithm s for fin d in g th e norm al form of traces T he firs t a lg o rith m is b ased on in teg er p o in ters a n d th e second one is based on dependence g p h s In th e n e x t su b sec tio n we b u ild a sim ple ite tiv e alg o rith m for finding the norm al form of a tra c e from its re p re se n ta tiv e 2.3 A lg o rith m fo r f in d in g the n orm al form o f tra ces We give a n in tu itiv e d e scrip tio n of th e algorithm F ir s t we consider th e in p u t strin g a s a se q u en ce of sin g le p a rts , every p a rt co n sists of one symbol The alg o rith m re p e a te d ly goes back on th e sequence of p a rts a n d sh ifts a symbol from a p a rt onto th e p rev io u s p a r t if th e symbol is in d e p e n d e n t w ith every symbol belonging to th e p rev io u s p a rt W hen no symbol can be shifted, th e algorithm term in a te s A lg o r ith m (“S h ift-le ft” a lg o rith m ): In p u t: A re lia n c e a lp h a b e t c = (£, I) and a s trin g w e z* D e cla tio n : L e t k = I w I , le t V be an a rra y of le n g th k over 2s and let u be an a rra y of le n g th k over I* C o m p u ta tio n: for i := to k v(i) := {i£>[i]}; 7':= ; re p e a t for ev ery a € u(j) begin H oang Chi T hanh 58 i := j - 1; OK := false-, w hile V b € v(i), (a ,b ) € I begin i:= i -1 if OK th e n begin v(j) := v(j) \ {o}; ư(i):= v(i) u {a}end; ; OK :=true end; end; 10 if v(j) - th e n ignore v(j) and d ecrease k := k - ; 1 j := + ; 12 u n til j > k ; 13 for i := to £ u(i) := lin(u(i,)) ; O utput: T he strin g s u (l), u(2), u(k) E x a m p le 2.8: L et c be th e reliance alp h a b et given in E xam ple 2.4 an d let U) = a e cb b e d Computing by the above algorithm, we have: V : (a/, lei I d , Ibl, Ibl, {el, id} ; k - V : iq i, ie, cl, lb), ibl, lei, IdI ; k = u : {a, bl, le, cl, (bl, lei, Idl ; k = V : la, bl, le, c, bl, lei, [ d j ; k = V : la, bl, le, c, b}, le, d l ; k = Hence, th e o u u t of th e algorithm is u( l ) = ab , u(2) = bee , u(3) = de Formalizing the above we get the'following result T h e o r e m 2.9: L et c = (£, I) be a relian ce alp h a b et a n d le t w e £* L et strin g s u(l), u(2), , u(k) be th e o u u t of A lgorithm 2.7 for th e in p u t (C,u;) T hen [u(l)].[u(2)] [u(k)\ is th e norm al form of [w] The alg o rith m is very sim ple and easy to im plem ent on com puter It tra n sfe rs a se q u en tial process re p re se n te d by a strin g into a c o n c u rre n t process T he com plexity of th is alg o rith m is ( k 2) Concurrency in P/T nets F irs t of all, we recall som e n o tatio n s concerning P e tri n ets 3.1 P la ce/T n sitio n nets A P etri net is a trip le N = (P, T, F), w here p, T a re d isjo in t se ts and F c ( P x T ) u (T X P) is a relatio n , so-called the flow relation of th e n e t N A n e t is sim ple if and only if its two different e le m e n ts h ave no common p re ­ se t and p ost-set A sim ple n e t is used to re p re se n t s ta tis tic a l s tru c tu re of a system From a sim ple n et one can co n stru ct different n e t m odels by adding some com ponents for re p re se n tin g dynam ical stru c tu re of th e system The Place/Transition net is such a net and is defined in [6] as follows: “S h itf-le ft” a l g o r i t h m s tr a n s f o r m in g s e q u e n tia l p ro c e s se s 59 D e fin itio n 3.1: The 6-tuple X = (P, T, F, K, M°, W) is called a rLace / T n sitio n net iff: l í = (P, T, F) is a sim ple net, whereas an elem ent of p is called a p l a c e and an elem ent of T is called a tra n sitio n K : p N N \ {oc} is a function assig n in g a w eight on each arc of the flow relation F :p u ^ is an in itia l m arking, which is not g re a te r th a n capacity on each place, i.e.: V p e p, M°(p) < K(p) The in itial m arking represents given tokens on each place of a net The tokens a re no g re a te r th a n th e cap a city of the corresponding place If to k en s on each place belonging to the pre-set of som e transition are greater than or equal to w eight of the arc connecting th is place to th e transition, i.e it is enough for “paying” then the nitial m ark in g can a c tiv a te th e corresponding tra n sitio n A fter perform ing the Place bei- n g to the p r e se t of th is“ ion are and tokens o 1 Kr COnneCting ^ cor^ P o n d i n g place to th is tra n sitio n ea ce beIon^ ng t0 the p °s t -set of th is tra n s itio n a re increased by weight of th e arc connecting th is tran sitio n to the corresponding place It m ust be ensured that new tokens on each place are not greater than the O pacity of that place perform edna n d t h in itia l T rk in g „activ ates som e tra n s itio n , th e tra n s itio n is tra n s itio n ĩ n d n we a new m ark in g ’ th e new m a rk ing can a c tiv a te a n o th e ĩ u pr0ces! re p e a te d ly continues in such a way T herefore, th e ac ivities h a p p e n e d on a P/T n e t will be m ath em atically form alized a s follows: ’ T h e m a r k i n g M : p -> N u {oc} can a c tiv a te a t r a n s i t i o n t iff: V p e 't , M ip) > w (p, t) and of t V p * ’ M (p^ ~ K (p^ " W ^ ' P^’ w here 't' t% a re th e p re -s e t an d th e po st-set t.h J n a l a s e ’ th e m a yk in g M is S0' called M o tiv a tin g A fter perform ance of th e tra n s itio n t, we get th e follow ing new m arking: M(p) - W(p,t) , if p M ’fpJ = M (p) + W (t,p) , if p e t' \ 't M (p) - W(p,t) + W (t,p) , if p e ' t n t ' , otherwise M (p ) and we often w rite th a t: M [í > M ’ »ím Ĩ This, Zt °11 a, SOrae 0ther, tra n siti0 n and th e n we s e t a " ° th “ m ark in g s reachable from th e m a rk in g M i s den o ted by ° sto ie spoce of * e " e t * narkings and ĩ : Ĩ : F ’ r , 11 is “ • ‘ f° r T b " • P /T "e t' i * * M'’ M/ M" be a ô>> * of be a sequence of tra n s itio n s of th e n e t I , such th a t: Hoang Chi T hanh 60 M‘ '[ í* > M ', ỉ = 1, 2, , n T he sequence M°[ t > M ‘[ t2 > M Mn l [ r > M n i l l u s t r a t e s aseq u en tial process of th e n e t and th e word a = t t2 tn e T * is called activities sequence on th e n et The set of all activities sequences on the net £ is called the la n g u a g e g e n e r a t e d by the net £ and denoted by L(z): L(E) = { t ể t2 t n 13 M 1, M , , M n l, Mn e *[M °] : M°[ t > M‘[ t2 > M2 Mn l[ tn > Mn} B u t th e lan g u ag e g e n erate d by a n e t is seq u en tial I t show s us only seq u en tial perform ances of th e P/T n e t’s processes So w hen several tra n s itio n s of th e n e t can be perform ed concurrently 3.2 Sequence o f m a x im a l concurrent steps L et u c T be a su b se t of tra n s itio n s of th e n e t z and u * D e f in itio n 3.2: T he su b set u is called a step on th e m ark in g M |«[M 0) satisfy in g th e following in equalities: V p e *u, M(p) > £ n e t I iff th e re is a w (p, t) and teU V p u \ M (p) < K(p) - X p )' teU In such a case, the transitions in the step u can be performed concurrently and a fte r th e ir perform ance we get th e following m arking: M(p)-ỵw(p,t) ưu M(p) + X w (t’P) , i f p u , p e u * \ p G * u n i f \ u * u M ’(p) = M(p) - ỵ W(p,t) tẻu + X w(t>p) tèu M(p) We also denote th a t: M[ u > M ’ and th e , i f u * , otherwise m arking M is called U -activatin g Such as above, we can find sequences of step s on th e n et As big are th e steps as hig h concurrency is E x a m p le 3.3: C onsider a P/T n e ts p resen te d by th e labelled directed b ip a rtite g rap h in Figure s h i t f - l e f t a lg o r ith m s tr a n s fo r m in g s e q u e n tia l processes ^ K M° Pi 3 P2 Ps P4 5 Ps F ig A P/T net On this net we recognize the following sequential process: M° [ tt > M1 [h > M2 [ t3 > M3 [t4> M4 Pi 2 P2 0 Pi 6 p4 2 Ps 1 The initial m arking M° can activate the subset {t„ t 4} and we have: — - M° [ {tj, t4} > M r = ( , , , , ) So th e su b se t {th t 4} is a c o n cu rren t step on th is P/T net L et M°ỊUi > M 'fUa > M Mk l[Uk > M k be a sequence of step s on th e n e t s The sequence illu strates a concurrent process on the net What steps are “biggest”? The following definition answ ers this question D e f in itio n 3.4: The sequence of step s M ^Ư ! > M 1[U2 > M Mk l[Uk> M k is called a sequence o f m a x im a l concurrent steps iff for each i - k-lVt G u i+1, M ''1 is not (UịUỊí}) -activating If transitions of each step can be performed concurrently, then the total time for perform ance of th e process decreases considerably T herefore, we alw ays expect to find sequences of m aximal concurrent steps and at that time, the performance of processes becomes optimal In order to so, we propose second “shift-left” algorithm in the next section H oang Chi Thanh 32 ị A lgorith m fin d in g s e q u e n c e s o f m a x im a l c o n c u r r e n t ste p s Let s = (P T F, K, M°, W) be a P/T net Each se q u en tial process: M °[i; > MUi > M2 > Mk of th e n e t m ay be considered as a sequence of single steps: M°[{*;} > M '[{í2} > M ,Mk l [{£*} > Mk and as an in p u t of our alg o rith m The algorithm repeatedly goes back on the sequence of steps and shifts a t r a n s i t io n from a s te p in to t h e p rev io u s ste p if w h en a d d in g th e t r a n s i t i o n to th is previo u s step, the o b ta in sd step becom GS activ a ted b y the co rresp o n d in g m arkin g When no transition can be shifted, the algorithm term inates A lg o r ith m 4.1 (“S h ift-left” alg o rith m 2): I n p u t: A se q u e n tia l process M°[£;> M'[£2> M M k *[£*> M k on a P/T net Output' A sequence of m axim al c o n cu rren t step s on th e net for i := to k u , := {£,} ; for j := to k-1 begin i := j ; w hile i >= begin for every tra n s itio n t e U i+1, if MM is (U ,u{i})-activating then begin we replace: M l l (p)- I W(p,t) , if p *(U, uW ) \ (U, W(t,p) , if p € (U, M l [t2 > M 2[t3 > M 3[t4 > M4 - After 1st going back: The m arking M° is {tj, t2}- activating, so we shift left t and get the follow ing sequence: M° [ > M1 M2 [ {t3} > [ {t4} > M3 Pi 2 P2 0 0 p3 p4 2 Ps 4 - A fter nd going back: The m arking M now is {t3, t 4}- activating, so we shift left t and obtain th e following sequence: M° [ {^2^ 2} > M1 [ > M2 Pi 2 p2 0 Ps p4 Ps The obtained sequence M° [{tlft 2} > M l [{t3, t 4) > M2 is indeed a sequence of maximal concurrent steps of the net Theorem : When Algorithm 4.1 term inates, its output is the sequence of maximal concurrent steps of the P/T net The com plexity of this algorithm is ( T I Ip I.k2) So the complexity is square in the number of steps This algorithm is sim ple and easy to im plem ent on computers Conclusion In the paper, we construct one more a very sim ple algorithm for finding the normal form of a trace; propose the notation of concurrent step on a P/T net and build up an efficient algorithm to transform sequential processes of a P/T net into concurrent ones These algorithm s are not only useful for concurrency control on system s but also suitable for calculating concurrent behaviours of a system with H o a n g Chi Thanh (34 jv n a m ic a l s tru c tu re s T he a lg o rith m s m ay be applied for processing tra n sac tio n s on d a ta b a se , for fin d in g th e norm al form of a sem i-trace A c k n o w le d g e m e n t- T his p a p er w as w ritte n d u rin g my sta y a t De M ontfort U n iv ersity, L eicester, UK I would like to th a n k P rofessor Hongji Yang, Dr D ang Van H u n g an d th e IIST /U N U for my v aluable tim e a t L eicester R eferen ces J I A alb ersb e rg a n d G R ozenberg, Theory o f Traces, T h eoretical C om puter Science 60(1988), pp 1-82 J.A Bergstra and J.w Klop, Algebra for com m unicating processes with a b stra ctio n , T h eo retical C om puter Science 37, 1(1985), pp 77-121 •3 R Janicki, T r a c e s e m a n t i c s fo r c o m m u n i c a t i n g s e q u e n t i a l processes, Tech R ep o rt R-85-12, U niv of A alborg, D enm ark, 1985 C oncurrent program schem es a n d DAIMI R e p o rt PB-78, A arh u s U niv., D enm ark, 1977 A M azurkiew icz, ị th eir interpretations, R M ilner, C o m m u n ica tio n a n d Concurrency, P ren tice H all, 1989 Ó w R eisig, P etri N ets: A n In tro d u ctio n , Springer-V erlag, 1985 f A w Roscoe, The Theory a n d Practice o f Concurrency, P re n tic e H all, 1998 ị H c T h a n h , A n a lg o rith m for fin d in g the norm al form o f traces and synchronous traces, J o u rn a l of C om puter Science and C ybernetics, Vol 17, No ỉ 1(2001), pp 72-77 H c T h a n h , C ontrol problem on T im ed place I tra n sitio n nets, VNUH Jo u rn a l of Science, Vol XX, No 4(2004), pp 48-55 ... of a trace; propose the notation of concurrent step on a P/T net and build up an efficient algorithm to transform sequential processes of a P/T net into concurrent ones These algorithm s are... ays expect to find sequences of m aximal concurrent steps and at that time, the performance of processes becomes optimal In order to so, we propose second “shift-left” algorithm in the next section... corresponding place It m ust be ensured that new tokens on each place are not greater than the O pacity of that place perform edna n d t h in itia l T rk in g „activ ates som e tra n s itio n , th e tra

Ngày đăng: 11/12/2017, 22:18

TỪ KHÓA LIÊN QUAN