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

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

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...

Trang 1

“SHIFT-LEFT” ALGORITHMS TRANSFORMING SEQUENTIAL PROCESSES INTO CONCURRENT ONES

H oang Chi T hanh

H a n o i 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.

1 IN TR O D U C TIO N

C ontrols on c o n c u rre n t sy stem s alw ays a re a n im p o r ta n t a n d com plicated problem So far, o p tim a l p erfo rm an ce of processes o ccu rred on a c o n c u rre n t system

is am ong th e controls F o r th is pu rp o se, recognition of c o n c u rre n t p ro cesses of th e system is e ss e n tia l A lo t of m odels, such as P e tri n e ts [6,9], tr a c e s [1,3,4,8], CSP [7], CCS [5], process a lg e b ra s [2] have been b e in g good to o ls for re p re s e n tin g

s ta tis tic a l as w ell as d y n a m ic a l s tru c tu re of sy stem s F rom th e s e m odels, se q u e n tia l processes of a sy stem 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 s fo rm se q u e n tia l processes of a sy ste m o n to c o n c u rre n t ones

is a g re a t pro b lem on th e o ry a n d ap p licatio n indeed

A sim p le a lg o rith m for fin d in g th e n o rm al form of tr a c e s is a good so lu tio n for

sy stem s re p re s e n te d by re lia n c e a lp h a b et P la c e /T ra n s itio n n e t is one of su ita b le

m odels to r e p r e s e n t c o n c u rre n t sy stem s B u t th e la n g u a g e g e n e r a te d by a P/T n e t is

se q u en tial I t show s u s only se q u e n tia l p erfo rm an ces of th e n e t ’s p rocesses So

w hen se v era l tr a n s itio n s c a n be perform ed c o n cu rren tly W e w ill c o n c e n tra te on

b u ild in g a n ite ra tiv e a lg o rith m for tra n sfo rm in g s e q u e n tia l p ro c e sse s of a P/T n e t

in to c o n c u rre n t ones

T his p a p e r is o rg a n iz e d as follows Section 2 c o n s tru c ts a “sh ift-le ft” alg o rith m for finding th e n o rm al form of a trace In Section 3 we p ro p o se th e n o ta tio n of concurrency in P/T n e ts Section 4 b u ild s up a n ite r a tiv e a lg o rith m for fin d in g sequences of m ax im al c o n c u rre n t ste p s on a P la c e /T ra n s itio n n e t from th e n e t’s sequence of sin g le ste p s F in a lly , som e conclusions a re given in S ectio n 5

2 N o rm a l fo r m o f t r 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 a te d by A M a rz u rk ie w ic z in [4] a s an a tte m p t

to provide a good m a th e m a tic a l d escrip tio n 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 tr a c e gives a n o p tim al w ay to p erfo rm a p ro ce ss re p re se n te d

55

Trang 2

56 H oa n g Chi T h a n h

by th e trace In th is sectio n we will c o n stru c t a sim p le ite r a tiv e a lg o rith m for finding th e n o rm al form of a trace

2.1 In d e p e n d e n c e r e la tio n a n d tr a c e s

D e f in i t io n 2.1: L et E be a n a lp h a b et

1 A n independence relation over z is a sy m m etric a n d irreflex iv e b in a ry

re la tio n over z

2 A reliance a lp h a b et is a couple c = (E, I), w h ere E is an a lp h a b e t a n d I is an

in d ep en d en ce re la tio n over s

C o n sid erin g a d ja c e n t in d e p e n d e n t sym bols in a s tr in g to be co m m u tin g , one can re la te d ifferen t s trin g s as follow

D e f in i t io n 2.2: L et c = (Z, I) be a relian ce a lp h a b e t

1 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 2 € E* and (a,6) € I such that X = x j a b x 2 and y = x j b a x 2.

2 T he C -equivalence relation =c c is d efin ed a s th e le a s t eq u iv alen ce

re la tio n over E* c o n ta in in g = c

T h u s, =c id e n tifie s ‘co m m u tativ ely sim ila r’ s trin g s — each such group of strin g s is called a trace

D e f in i t io n 2.3: L et c = (£, I) be a relian ce a lp h a b e t

1 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 =c containing X.

2 A t r a c e over c is a set t of strings over E such th a t t = [*]c for some X e £*

and X is called a rep resen ta tive of t

3 A se t of tra c e s over c is called a trace la n g u a g e o v er c

E x a m p le 2.4: L et c = (E, I) be th e relian ce a lp h a b e t given by th e u n d irec te d

g ra p h in Fig 1

T he trac e t of abcecd = [abcecd]c = {abcecd, bacecd, acbecd, abeccdy abcced, abcedcy baeccd, bacced, bacedc, acebcd, acbced, acbedc, aebccd, abecde, abccdel.

2.2 N o r m a l form o f tr a c e s

One can d efine a com position o p eratio n on tra c e la n g u a g e

Trang 3

D e f i n i t i o n 2.5: L e t c — (£, I) be a relian ce a lp h a b e t.

F o r tra c e s t h t 2 over c , the trace com position of tj a n d t2, d en o ted by t,.t2, is

defined by t , t 2 = [Xj.x2]c> w here Xj, x 2 € £* are rep resen tatives of tỵ and t 2

respectively

In g e n e ra l, a tra c e c an be o b ta in e d as a tra c e com position of o th e r trac es b u t trac e d eco m p o sitio n s of th e given tra c e do not h av e to be u n iq u e Hence it is

d e sirab le to h a v e ‘n o rm a l fo rm ’ decom position of trac es

D e f i n i t i o n 2.6: L e t c = (£, I) be a relian ce a lp h a b e t a n d / be a tra c e over c

T he follow ing d eco m p o sitio n t = t ,.t 2 □ tm, such th a t:

1 for a ll 1 s i s m, £, * 0 ;

2 for all 1 < i < m , t, can be w ritten as [«;], w here Uị G £*, #a(u,)=l for each a e

alph(u,), an d (a ,b ) e I for a ll a, b e alph(Uj) such t h a t a # b ; a n d

3 for a ll 1 s ỉ' s m -1, if Í, = [Uj] and t Uj = [ui+1] th e n , for each a e a lp h ( u 1+i),

there ex ists b e alph (ii(), such th a t (a , b ) Ể I; is called the norm al form of the trace t.

In [1] J I A a lb e rsb e rg a n d G R ozenberg p o in te d o u t t h a t every trac e can be

u n iquely decom posed in to a n o rm a l form, i.e a m in im a l n u m b e r of ‘m axim al

in d e p e n d e n t p a rts T hey h a v e b u ilt two a lg o rith m s for fin d in g th e n o rm al form of traces T he f ir s t a lg o rith m is b a se d on in te g e r p o in te rs a n d th e second one is b ased

on d ependence g ra p h s

In th e n e x t su b se c tio n we b u ild a sim ple ite r a tiv e a lg o rith m for finding th e norm al form of a tra c e from its re p re s e n ta tiv e

2.3 A lg o r ith m fo r f i n d i n g the n o rm a l fo rm o f tr a c e s

We give a n in tu itiv e d e sc rip tio n of th e a lg o rith m F ir s t we co n sid er th e in p u t

s trin g a s a se q u e n c e of sin g le p a rts , every p a r t c o n sists of one symbol T he

a lg o rith m re p e a te d ly goes b ack on th e sequence of p a r ts a n d sh ifts a sym bol from a

p a rt onto th e p re v io u s p a r t if th e sym bol is in d e p e n d e n t w ith every sym bol belonging to th e p re v io u s p a rt W hen no sym bol can be sh ifted , th e alg o rith m

te rm in a te s

A l g o r i t h m 2 7 (“S h ift-le ft” a lg o rith m 1):

In p u t: A re lia n c e a lp h a b e t c = (£, I) a n d a s trin g w e z*.

D e cla ra 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 a n d let u be an

a rra y of le n g th k over I*.

C o m p u ta tio n :

1 for i := 1 to k do v(i) := {i£>[i]};

2.7':= 2;

3 re p e a t

4 for e v ery a € u(j) do

5 begin

Trang 4

58 H oan g Chi T h a n h

6 i := j - 1; OK := false-,

7 w hile V b € v(i), (a ,b ) € I do begin i := i - 1 ; OK := true end;

8 if OK th e n begin v(j) := v(j) \ {o}; ư(i) := v(i) u {a} end;

9 end;

10 if v(j) - 0 th e n ignore v(j) an d d ecrease k := k - 1 ;

1 1 j := 7 + 1 ;

12 u n til j > k ;

13 for i := 1 to £ do u(i) := lin(u(i,)) ;

O utput: T h e strin g s u (l), u(2), u(k)

E x a m p le 2.8: L et c be th e relian ce a lp h a b e t given in E x am p le 2.4 a n d let

U) = a e c b b e d Com puting by the above algorithm , we have:

V : (a/, lei I d , Ibl, Ibl, {el, id} ; k - 7

V : iq i, ie, cl, lb), ibl, lei, IdI ; k = 6

u : {a, bl, le, cl, (bl, lei, Idl ; k = 5

V : la, bl, le, c, bl, lei, [ d j ; k = 4

V : la, bl, le, c, b}, le, d l ; k = 3

Hence, th e o u tp u t of th e alg o rith m is u( l ) = ab , u(2) = bee , u(3) = de

Form alizing the above we get the'following result.

T h e o r e m 2.9: L et c = (£, I) be a relian c e a lp h a b e t a n d le t w e £* L et strin g s u(l), u(2), , u(k) be th e o u tp 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 n o rm al form of [w].

The a lg o rith m is very sim ple an d easy to im p lem en t on co m p u ter I t tra n s fe rs

a se q u e n tia l process re p re se n te d by a s trin g in to a c o n c u rre n t process T he

com plexity of th is a lg o rith m is 0 ( k 2).

F ir s t of all, we recall som e n o ta tio n s concerning P e tr i n e ts

3.1 P la c e /T r a n s itio 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 a n d F c ( P x T )

u (T X P) is a re la tio n , so-called the flow relation of th e n e t N.

A n e t is sim ple if a n d only if its two d ifferen t e le m e n ts h av e no common p re ­

se t and p o st-set A sim p le n e t is used to re p re se n t s ta tis tic a l s tr u c tu r e of a system From a sim ple n e t one can co n stru ct d ifferen t n e t m odels by adding some

co m p o n en ts for re p re s e n tin g dynam ical s tru c tu re of th e system T he

Place/Transition net is such a net and is defined in [6] as follows:

Trang 5

D e fin itio n 3.1: The 6-tuple X = (P, T, F, K, M°, W) is called a

an elem ent of T is called a tra n sitio n

2 K : p N <u {cc} is a function showing a capacity on each place.

3 w : F -> N \ {oc} is a function a ssig n in g a w eight on each a rc of th e flow

relation F.

: p u ^ is a n in itia l m a rkin g , w hich is n o t g r e a te r th a n cap acity

on each place, i.e.: V p e p, M°(p) < K(p).

The in itia l m arking rep resen ts given tokens on each place of a net The tokens

a re no g r e a te r th a n th e c a p a c ity of th e co rresp o n d in g place I f to k e n s on each place

belonging to the pre-set of som e transition are greater than or equal to w eigh t of the

arc connecting th is place to th e tran sitio n , i.e it is enough for “p ay in g ” th en th e

n itial m a rk in g can a c tiv a te th e corresponding tra n s itio n A fter p erfo rm in g th e

Place bei- 2 n g to the p r e s e t of th is “ ion are

an d tokens o 7 1 1 K r COnneCting ^ cor^ P o n d i n g place to th is tra n s itio n

ea ce beIon^ ng t0 th e p ° s t -se t of th is tra n s itio n a re in creased by

w eight of th e a rc co n n ectin g th is tra n sitio n to th e co rresp o n d in g place I t m u st be

ensured that new tokens on each place are not greater than the O p a city of that place

perform edna n d t h in itia l T r k in g „a ctiv a tes som e tra n s itio n , th e tr a n s itio n is tra n s itio n ĩ n d n we a new m a rk in g ’ th e new m a rk in g can a c tiv a te a n o th e ĩ

ac iv ities h a p p e n e d on a P/T n e t will be m a th e m a tic a lly fo rm 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:

1 V p e 't , M ip) > w (p, t) a n d

of t 2 V p 6 * ’ M (p ^ ~ K (p^ " W ^ ' P^’ w here 't' t% a re th e p re -s e t a n d th e p o st-se t

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 p erfo rm an ce of

th e tra n s itio n t, we g et th e follow ing new m arking:

M (p) - W(p,t) + W (t,p) , if p e ' t n t '

and we often w rite th a t: M [í > M ’

SOrae 0 th er, tra n s iti0 n a n d th e n we s e t a " ° th “

»ím Ĩ This, Z t °11 a, m a rk in g s reach ab le from th e m a rk in g M i s d e n o te d by

narkings and ĩ : Ĩ : F ’ r T b " • P /T "e t' i * * M' ’ M/ M" be a “ «>>•“ * of

, be a seq u en ce of tra n s itio n s of th e n e t I , su ch th a t:

Trang 6

60 H oang Chi T h an h

M‘ '[ í* > M ', ỉ = 1, 2, , n.

T h e seq u en ce M°[ t 1 > M ‘[ t2 > M2 Mn l [ r > M n i l l u s t r a t e s a se q u e n tia l

process of th e n e t a n d th e w ord a = t 1 t2 tn e T * is called a ctivities sequence on

th e n et

The set of all a ctivities sequences on the net £ is called the l a n g u a g e g e n e r a t e d

by the n et £ a n d d en o ted by L(z):

L(E) = { t ể t 2 t n 13 M 1, M2, , M n l, Mn e *[M °] :

M°[ t 1 > M ‘[ t2 > M2 Mn l [ tn > Mn}

B u t th e lan g u a g e g e n e ra te d by a n e t is se q u en tial I t show s us only se q u e n tia l

p erfo rm an ces of th e P/T n e t’s processes

So w hen se v era l tra n s itio n s of th e n e t can be perform ed co n currently

3.2 Sequence o f m a x i m a l co n cu rren t ste p s

L et u c T be a s u b s e t of tra n s itio n s of th e n e t z an d u * 0

D e f i n i t i o n 3.2: T h e su b se t u is called a step on th e n e t I iff th e re is a

m ark in g M 6 |«[M 0) sa tisfy in g th e follow ing in eq u alities:

1 V p e *u, M(p) > £ w (p, t ) an d

teU

2 V p 6 u \ M (p) < K(p) - X p )'

teU

In such a case, the tran sitions in the step u can be performed concurrently

an d a fte r th e ir p e rfo rm an c e we get th e follow ing m arking:

M ( p ) - ỵ w ( p , t )

ưu , i f p 6 u \ u

M(p) + X w (t’P) , i f p e u * \ * u

M(p) - ỵ W(p,t) + X w (t>p) , i f p G * u n u *

M ’(p) =

W e also denote th a t: M[ u > M ’ a n d th e m ark in g M is called U -activ atin g Such as above, we can find sequences of ste p s on th e n e t As big a re th e steps

a s h ig h concurrency is

E x a m p le 3.3: C o n sid er a P/T n e ts p re s e n te d by th e lab elled d irected b ip a rtite

g ra p h in F ig u re 2

Trang 7

K M°

On this net we recognize the following sequential process:

[ t 4 > M4

0

— - - 4

The in itial m arking M° can activate the subset {t„ t4} and we have:

M° [ {tj, t4} > M r = (1, 2, 6, 0, 1)

So th e su b s e t {th t 4} is a c o n c u rre n t step on th is P/T net.

L et M°ỊUi > M 'fU a > M2 Mk l [Uk > M k be a sequence of ste p s on th e n e t s

The sequence illu stra tes a concurrent process on the net What steps are “biggest”? The following definition answ ers this question.

D e f i n i t i o n 3.4: T he seq u en ce of ste p s M ^Ư ! > M1[U2 > M2 Mk l [Uk> M k is

called a sequence o f m a x im a l concurrent steps iff for each i - 1 2 kl

-V t G u i+1, M''1 is not (UịUỊí}) -activ atin g

If tran sition s of each step can be performed concurrently, then the total time

for p erfo rm an ce of th e process d e crea se s considerably T herefore, we alw ays expect

to find sequences of m axim al concurrent steps and at that tim e, the performance of processes becomes optim al In order to do so, we propose second “sh ift-left” algorithm in the next section.

Trang 8

32 H o a n g Chi T han h

A lg o rith 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 s te p s

Let s = (P T F, K, M°, W) be a P/T n et Each se q u e n tia l process: M °[i; > MUi2

> M2 > Mk of th e n e t m ay be considered as a seq u en ce of sin g le step s: M°[{*;} > M '[{í2} > M2 ,Mk l [{£*} > Mk a n d as a n in p u t of o u r a lg o rith m

The algorithm repeatedly goes back on the sequence of step s and shifts a

t r a n s i t i o n from a s te p in to t h e p r e v io u s s te p if w h e n a d d i n g t h e t r a n s i t i o n to t h i s

p r e v i o u s s t e p , t h e o b t a i n s d s t e p b e c o m G S a c t i v a t e d b y t h e c o r r e s p o n d i n g m a r k i n g When no transition can be shifted, the algorithm term inates.

A lg o r ith m 4.1 (“S h ift-le ft” a lg o rith m 2):

I n p u t: A s e q u e n tia l process M°[£;> M'[£2> M2 M k *[£*> M k on a P/T n et

Output' A seq u en ce of m ax im al c o n c u rre n t ste p s on th e n et.

1 for i := 1 to k do u , := {£,} ;

2 for j := 1 to k-1 do

3 begin

4 i := j ;

5 w hile i >= 1 do

begin

for every tr a n s itio n t e U i+1,

if MM is (U ,u{i})-activatin g then begin we replace:

M ‘(p) =

tẻ ư ịẩ ịtì

tẻ U ịẩ ltl

tè U ịẩ ltl tè U ịẩ lt)

M l I (p)

, if p 6 *(U, u W ) \ (U,

, if p € (U, <j{t}Y \ *(Ui u{i})

, if p e *(U, u{í}) n (U,

, otherwise

an d u, := UịU{í} , Ui+1 := ui+1\{i} , i.e we “sh ift-le ft” th e tr a n s itio n t from the

ỉtep u +1 into the previous step Uj After shifting, if u i+ 1=0then we ignore both ui+1

1 A /ĩi+ 1

and Ml+1;

end ;

i := i - 1

end :

6 end ;

7 stop.

The algorithm goes back because we w ant not only m aking step s maximal concurrent but also reducing the number of steps.

Trang 9

Example 4.2: We apply this algorithm to the P/T net drawn in Fig 2 with tltu inp ut M°[íi > M l [t2 > M 2[t3 > M 3[t4 > M4.

- After 1st going back:

The m arking M° is {tj, t 2}- activating, so we sh ift left t 2 and get the follow ing

sequence:

- A fter 2nd going back:

The m arking M 1 now is {t3, t 4}-activating, so we shift left t 4 and obtain th e following sequence:

The obtained sequence M° [{tlft 2} > Ml [{t3, t 4) > M2 is indeed a sequence of

m axim al concurrent steps of the net

Theorem 4.3: When Algorithm 4.1 term inates, its output is the sequence of

m axim al concurrent step s of the P/T net.

The com plexity of th is algorithm is 0 ( 1 T I I p I k 2). So the complexity is square

in the num ber of steps This algorithm is sim ple and easy to im plem ent on computers.

In th e 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 efficien t algorithm to transform sequ en tial processes of a P/T net into concurrent ones T hese algorithm s are not only useful for concurrency control on system s but also su itab le for calculating concurrent behaviours of a system with

Trang 10

(34 H o a n g Chi Thanh

jv n a m ic a l s tr u c tu r e s T he a lg o rith m s m ay be ap p lied for p ro cessin g tra n sa c tio n s on

d a ta b a s e , for fin d in g th e n o rm al form of a sem i-trace

A c k n o w le d g e m e n t- T h is p a p e r w as w ritte n d u rin g my sta y a t De M ontfort

U n iv ersity , L e ic e ste r, UK I would like to th a n k P ro fesso r H ongji Y ang, Dr D ang Van H u n g a n d th e IIST /U N U for my v a lu a b le tim e a t L eicester

R e fe r e n c e s

1 J I A a lb e rsb e rg a n d G R ozenberg, Theory o f Traces, T h eo retical C om puter

Science 6 0(1988), pp 1-82

2 J.A Bergstra and J.w Klop, Algebra for com m un icatin g processes with

a b stra c tio n , T h e o re tic a l C o m p u ter Science 37, 1(1985), pp 77-121.

•3 R Janicki, T r a c e s e m a n t i c s f o r c o m m u n i c a t i n g s e q u e n t i a l p r oc e s s e s , Tech.

R ep o rt R -85-12, U niv of A alborg, D en m ark , 1985

4 A M azu rk iew icz, C oncurrent p ro g ra m schem es a n d th e ir interpretations,

DAIMI R e p o rt PB -78, A a rh u s U niv., D en m ark , 1977

ị R M iln er, C o m m u n ic a tio n a n d C oncurrency, P re n tic e H all, 1989.

Ó w R eisig, P etri N ets: A n In tro d u c tio n , S p rin g er-V erlag , 1985.

f A w Roscoe, The Theory a n d P ractice o f C oncurrency, 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 n o rm a l fo rm o f traces and syn ch ro n o u s traces, J o u r n a l of C o m p u ter Science a n d C y b ern etics, Vol 17, No

1(2001), pp 72-77

H c T h a n h , C ontrol p ro b lem on T im ed place I tra n sitio n nets, VNUH J o u rn a l of

Science, Vol XX, No 4(2004), pp 48-55

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

TỪ KHÓA LIÊN QUAN