Deadlock Avoidance Policy in Mobile Wireless Sensor ... - IntechOpen

3 downloads 0 Views 643KB Size Report
simple mobile wireless sensor networks (MWSN) (which ...... r v. F. F. F. F. I = . Note that there are no input arcs to transitions from the places in PO, so that. 0. = o.
Deadlock Avoidance Policy in Mobile Wireless Sensor Networks with Free Choice Resource Routing Prasanna Ballal, Abhishek Trivedi and Frank Lewis Automation & Robotics Research Institute, University of Texas at Arlington, 7300 Jack Newell Blvd. S., Fort Worth, TX 76118-7115, USA. Corresponding author E-mail: [email protected]

Abstract: Efficient control schemes are required for effective cooperation of robot teams in a mobile wireless sensor network. If the robots (resources) are also in charge of executing multiple simultaneous missions, then risks of deadlocks due to the presence of shared resources among different missions increase and have to be tackled. Discrete event control with deadlock avoidance has been used in the past for robot team coordination for the case of multi reentrant flowline models with shared resources. In this paper we present an analysis of deadlock avoidance for a generalized case of multi reentrant flow line systems (MRF) called the Free Choice Multi Reentrant Flow Line systems (FMRF). In FMRF, some tasks have multiple resource choices; hence routing decisions have to be made and current results in deadlock avoidance for MRF do not hold. This analysis is based on the so-called Circular Waits (CW) of the resources in the system. For FMRF, the well known notions of Critical Siphons and Critical Subsystems must be generalized and we redefine these objects for such systems. Our second contribution provides a matrix formulation that efficiently computes the objects required for deadlock avoidance in FMRF systems. A MAXWIP dispatching policy is formulated for deadlock avoidance in FMRF systems. According to this policy, deadlock in FMRF is avoided by limiting the work in progress (WIP) in the critical subsystems of each CW. Implemented results of the proposed scheme in a WSN test-bed is presented in the paper. Keywords: Deadlock Avoidance, Petri nets, Discrete Event Systems, MRF, FMRF, Intelligent Control, WSN, mobile robots, robot sensors.

1. Introduction Wireless Sensors on mobile platforms can greatly extend the applications of stationary sensor networks ([Chong et al. 2003, Puccinelli et al. 2005, Sinopoli et al. 2003]). The ability of such systems to automatically adapt the topology of the network to the new operating conditions can be used to perform optimal node deployment, adaptive sampling, network repair, event detection [Dantu et al. 2005]. In order to develop a wide area distributed sensor network with self-configuring mechanisms, related research usually considers sensor networks composed of cheap stationary sensors and expensive mobile robotic sensors. Hence, a mobile sensor network can be considered as a multi-robot system with heterogeneous resources. The coordination of a multi-robot system for the execution of cooperative tasks has become an active research area [Butler et al., Cortes et al., Gerkey et al. 2002]. The related literature has extensively tackled the problem of dynamic resource assignment, to on-line allocate a resource to a task according to predefined criteria [Gerkey et al. 2004]. However in most cases the robot team is in charge of executing one mission at a time and no shared resource International Journal of Advanced Robotic Systems, Vol. 5, No. 3 (2008) ISSN 1729-8806, pp. 279-290

conflicts arise. If multiple missions are executed simultaneously, then it is necessary to constraint the dynamic resource assignment algorithm in order to avoid assignments which lead to shared resource conflicts and deadlocks (see e.g. [Ezpeleta et al. 1995, Murata 1989, Ballal 2006] for an introduction to Petri Nets and deadlock avoidance policies). In [Giordano et al. 2006], a matrix-based discrete event controller (DEC) [Tacconi et al. 1996] has proved to be particularly useful for sequencing multiple missions in simple mobile wireless sensor networks (MWSN) (which can be considered as a particular multi-robot system). However, since the peculiarities of MWSN require multiple competing missions and network topology changes, including mobility and addition/removal of nodes, dynamic resource assignment and routing algorithms should be included in the framework of the DEC. Several existing approaches in the literature are designed for the case of Multi Reentrant Flow Line systems (MRF) [Ballal et al. 2006, Ezpeleta et al. 1995, Ezpeleta et al. 2002, Gurel et al. 2000, Lewis et al. 1998, Xing et al. 1991], where resources are shared and can perform more than one task. Analysis of deadlock avoidance is well understood for

279

International Journal of Advanced Robotic Systems, Vol. 5, No. 3 (2008)

MRF. An important aspect in deadlock avoidance strategies in MRF is the concept of a Circular Wait (CW) [Wysk et al. 1991] among the resources. It has been shown in [Ezpeleta et al. 2002, Lewis et al. 1998, Wysk et al. 1991, Xing et al. 2005] that deadlock occurs in MRF when blocking develops in a CW. The analysis of shared resources becomes even harder when there are multiple choices of resources for a given task. This means routing decisions have to be made [Ozmutlu et al. 2005]. These systems are a generalized case of MRF systems called the Free Choice MultiReentrant Flow Lines (FMRF). In FMRF, more than one resource can perform same task in the system. In other words, some tasks in FMRF may not have predetermined resources assigned. This is the case, for instance, in wireless sensor networks [Lewis 2004]. In the case of FMRF, the known methods of deadlock avoidance provided for MRF do not work. For analysis, modeling and control of DES, Petri Nets (PN) [Fanti et al. 2000, Murata 1989, Peterson 1981] have been extensively used. Though the PN framework offers rigorous ground for theoretical analysis, it is sometimes inconvenient for actual computational analysis of the practical DES, causing problems of computational complexity in scheduling and deadlock avoidance. PN theory does not provide efficient computational means for computing objects such as circular waits, siphons, etc. In the past decade, considerable research has been done on developing deadlock control policies and routing in PN structures [Fanti et al. 2004]. In the literature, the deadlock problem has been tackled using methods as deadlock prevention (DP) [Ezpeleta et al. 1995], deadlock avoidance (DA) [Ezpeleta et al. 2002, Gurel et al. 2000, Mireles et al. 2002, Piroddi et al. 2005] and deadlock detection/recovery (DR) [Wysk et al. 1991]. DR methods allow the occurrence of deadlocks and then specify procedures to recover the correct process functioning. In DP methods, the system model is modified off-line so that the resulting controlled model is deadlock-free. DA algorithms check the system flow on-line to see that the system does not fall in a deadlock state. DP and DA approaches require setting up a suitable control policy to regulate the shared resource allocation in the system. In general, DA using siphon analysis is known to be NPhard [Gurel et al. 2000, Park et al. 2001, Reveliotis 2001]. There are many optimal and sub-optimal modular approaches [Judd et al. 2000, Piroddi et al. 2005, Xing et al. 1991, Xing et al. 2005] for deadlock avoidance using PN structures. Also, matrix techniques that exploit the PN structure can be used to alleviate this [Ballal et al. 2006, Fanti et al. 2000, Fanti et al. 2004, Giordano et al. 2005, Leis et al. 1998, Lewis et al. 2004, Maione et al. 2001, Mireles et al. 2002, Zhao et al. 2005]. In this paper, we provide an extension of the matrixbased DA from MRF systems to FMRF systems. PN objects such as Circular Waits, Critical Siphons, and Critical Subsystems have to be computed to avoid deadlock in MRF. Due to the existence of decision place

280

in FMRFs, which are followed by two or more decision branches, these objects cannot be used for deadlock avoidance without redefinition. In this paper we show how these objects can be computed for FMRF. The key issue is that it is necessary to redefine, or generalize the definition of, critical subsystems for FMRF. Also, we provide a matrix formulation which can efficiently compute these objects for FMRF. This matrix formulation allows fast and efficient numerical computation techniques to be applied to PN analysis. We show how a MAXWIP dispatching policy can be formulated for FMRF to avoid blocking phenomena. Under this policy, deadlock in FMRF can be avoided by limiting the work in progress (WIP) in the Critical Subsystems of each CW. Note that the formulation provided in this paper is applicable to only first order deadlocks. There are other deadlock structures called second order deadlocks which occur due to the presence of key resources. The rest of the paper is organized as follows. In Section 2 we describe the properties that characterize FMRF systems using Petri Nets. In Section 3 we show the correlation between circular waits and structures referred to as Critical Siphons and Critical Subsystems. We generalize the notion of critical siphon to the case of FMRF. Section 4 presents a matrix formulation over an or/and algebra that makes it efficient and direct to compute the Petri Net objects needed for deadlock avoidance. In Section 5 we present the implemention of the proposed strategy in an actual sensor network testbed. 2. Petri Net Analysis In this section we provide a brief background on Petri Nets and different objects used in PN for deadlock avoidance. We provide a formal definition for FMRF systems. A. Petri Nets A Petri net (PN) a bipartite digraph (P, T, I, O), where P is the set of places, T is a set of transitions, I is the set of input arcs from places to transitions, and O is the set of outputs arcs from transitions to places. One can represent I as an input incidence matrix which has I(i,j) =1 if there is an input arc from place j to transition i and O as an output incidence matrix which has O(i,j)= 1 if there is an output arc from transition i to place j. The incidence matrix is defined as W=O-I

(1)

Given a node v (either transition or place), we define •v as the pre-set of v (set of nodes with arcs to v) and v • as the post-set of v (set of nodes with arcs from v). Similarly, for a set of nodes S= {vi}, define •S = {•vi } and S • = {vi •} . The following assumptions allow one to represent a discrete event system by a Petri Net: 1. There are no resource failures.

Prasanna Ballal, Abhishek Trivedi and Frank Lewis: Deadlock Avoidance Policy in Mobile Wireless Sensor Networks with Free Choice Resource Routing

2. No pre-emption. A resource cannot be removed from a job until it is complete. 3. Mutual exclusion. A single resource can be used for only one job at a time. 4. Hold while waiting. A process holds the resources already allocated to it until it has all the resources required to perform a job. B. Reentrant Flow Lines A special case of PN is the multi reentrant flow-line system (MRF), see Figure 1. For MRF systems, we partition the set of places, P = J ∪ R ∪ PI ∪ PO , with the places in J, R, PI, PO representing respectively, the jobs performed, the availability of resources, input of parts, and output of products. Each part path starts with a PI-place and terminates with a PO-place. We denote the set of job places J for part type j as Jj so that J = ∪ j J j . Let the set of transitions along part path j be xj1, xj2,…,xjLj, with xj1 and xjLj being the initial and terminal transitions respectively. R(p) is the set of resources needed by job p. For any resource r ∈ R define the jobs performed by r as J (r ) . We partition the resource set R as Rs and Rns, with Rs being the set of shared resources, i.e. those needed for more than one job, and Rns being the set of non-shared resources.

Then, J ( r ) = 1 if r ∈ Rns and J ( r ) > 1 if

r ∈ Rs , with |S| denoting the cardinality of a set S (i.e. the number of elements). More general than MRF are the free-choice multi reentrant flow-line systems (FMRF), which have no predetermined resource allocation for the jobs. That is, several different resources may be capable and available to perform a specific job. Then, routing decisions may be required along the part path about which resources to use for the next job, see Figure 2. We formally define FMRF systems as a class of systems satisfying the following properties ( φ being the empty set): Properties of FMRF 1. p ∈ P,• p ∩ p• = φ 2. on part path j, xj1 • ∩ P \ J = φ and • x jLj ∩ P \ J = φ 3. ∀p ∈ J , • • p ∩ R = p • • ∩ R = R ( p )

with

R( p) = 1 4. p ∈ J ,

p• ≥1

5. ∀p i , p k ∈ J j , i ≠ k , p i ≠ p k 6. ∀p i ∈ J j ,

p k ∈ J l , j ≠ l , p ji • ∩ p lk • = φ

7. Rs ≠ φ This means that there are: (1) no self loops, (2) each part path has a well-defined beginning and an end, (3) every job requires only one resource with no two consecutive jobs using the same resource, (4) there may be some jobs that can be done by different resources (i.e. routing decisions may have to be made), (5) there are no part path

R1

Pi1

t1 R1A t2

R2A

R3

t3

R1B t4

R3A t5

Po1

R2 Pi2

t6

R4A t7

R2B t8

R4

R6A t9

Po2

R6

Fig. 1. MRF system B1

Pi1

t1

B1

R1

t2 R1A t4

t3

R2A t5

R2

B2

B2

R3

t6

t7

R3A t8

B3

B3

t10 R5A t11 Po1

R4A t9

R4

R5

Fig. 2. FMRF system loops, (6) for any two distinct jobs on different part paths there is no assembly, i.e. two part paths cannot merge into one, (7) there are shared resources. According to property 3, R( p ) = • • p ∩ R = p • • ∩ R , with the cardinality R( p) = 1 ;

Under the foregoing

assumption, one has J ( r ) = r • • ∩ J = • • r ∩ J . Property 4 distinguishes MRF from FMRF systems. A FMRF system can have p • > 1 for some p ∈ J , so that routing decisions are needed. We call such job places ‘decision places’. In MRF, one has p • = 1 ∀p ∈ J . That is, MRF are a special class of FMRF. A transition

x∈ p•

is said to be a posterior transition of p. A decision place has multiple posterior transitions, i.e.

p • > 1 . The

resources used by decision places are called decision resources. Figure 1 shows a MRF system, while Figure 2 shows a FMRF system. In Figure 1 the part paths are independent and neither split nor recombine. R1 is a shared resource along a single part path, and R2 is a shared resource between two part paths. In Figure 2 the part paths split at decision places. The decision places are B1 and B2, each followed by two transitions. A choice is required there to decide which resource (R1 or R2, respectively R3 or R4) to use for the next job. C. Circular Wait (CW) The following background is taken from [Ezpeleta et al. 1995, Lewis et al. 1998, Wysk et al. 1991]. We say resource ri waits for resource rj (denoted ri rj) if the availability of rj is an immediate prerequisite for the release of ri, i.e., •ri ∩ r j • ≠ φ . A wait relation digraph is defined as Gw = (R, A) where R is the set of nodes and A = {aij} is the set of edges with aij drawn if ri rj (i.e. each aij represents a transition in •ri ∩ r j • ). In Gw, define an R-path between

281

International Journal of Advanced Robotic Systems, Vol. 5, No. 3 (2008)

ri and rk as a set of R-places such that ri rj … rk. Then ri is said to wait over an R-path for rk, denoted ri

rk , if

there is an R-path between ri and rk. A circular wait (CW) is a set of resources C ⊂ R , with |C|>1, such that for any r j . A CW always contains ordered pair {ri , r j } ⊂ C, ri at least one shared resource. The simplest CW is a set of resources C ⊂ R , such that for some appropriate re-labeling, one has r1 → r2 → ... → rq → r1 , with for ri ≠ r j

i ≠ j , 1 ≤ i, j ≤ q . This will be referred to as a simple circular wait. A simple circular wait is a simple circuit in the graph and is a CW not containing any other CW. Consider a wait relation graph Gw and a CW C ⊂ G w .

Then for every r ∈ C , there exists at least one simple circular wait σ ⊂ C such that r ∈ σ . A CW is a strongly connected sub graph in the digraph Gw and can be obtained by taking unions of non-disjoint simple CW. Given a CW C= {ri}, one can partition the set of transitions •ri as •ri = •rio ∪ •ri + , where •rio = {x ∈ T | • x ∩ C ≠ φ} , the set of input transitions of ri

with

input

arcs

from

other r j ∈ C ,

some

and

•ri + = {x ∈ T | • x ∩ C = φ} , the set of input transitions of ri with no input arcs from any other r j ∈ C . We loosely say that the transitions •rio are ‘in the CW C’. n

The job set of CW C= {ri} is given by J(C) =

∪ i =1

Partition

this

as

= J (C ) + ∪ J (C ) 0 ,

J(C)

J (ri ) . where

J (C ) 0 = { p ∈ J (C ) | p• ∈ •rio , ri ∈ C} and J (C ) + = { p ∈ J (C ) | p• ∈ •ri + , ri ∈ C} . Note

that

for

∩ J (C ) 0 ≠ φ .

have J (C ) +

FMRF,

one

In fact, if

p ∈ J (C ) is a

decision place with C a simple CW, i.e.

may

p • > 1 so that it

has more than one posterior transition, then, p ∈ J (C ) + and p ∈ J (C ) 0 . This is precisely what distinguishes deadlock avoidance in MRF from deadlock avoidance in FMRF systems. Figure 3 shows a FMRF system. Here, R1-B2-M1-B3 is a CW C. Here, r1a, m1, b2 and b3 are in J(C)0 and r1b is in J(C)+. b2 and b3 are decision places and B2 and B3 are the respective decision resources. In FMRF systems, due to their construction, the decision places (b2 and b3 in this example) are also a part of J(C)+.

D. Marking, Place Vector A place p ∈ P = J ∪ R ∪ PI ∪ PO is said to be marked when it contains a token, which depending on the place containing it indicates an ongoing job, the existence of an available resource, a part in, or a product out. In a FMRF, the initial marking vector denoted as m0 assigns tokens only to R and PI-places. It is assumed that the PO-places are always empty. Given p ∈ P , m(p) denotes the marking of p, i.e. the number of tokens in p. Given a set of places S, m(S) denotes the number of tokens in S. A set of places is said to be unmarked or empty if none of its places has any tokens. Given the set of places P, the PN place vector, or p-vector,

p to

has dimension of P , and one element corresponding each

place.

Let

the

set

of

all

places

be

P = { p1 , p 2 ,..., pQ } . Then the place vector has Q

elements. Any set of m places

{ pik ∈ P | k = 1,2,..., m}

can be represented as a |P|-vector

p

having m entries

p ik = 1 and zero entries otherwise. The PN marking vector

m( p) = [m( p1 ) m( p 2 )

] T∈ N

P

,

with

the

natural numbers N= {0, 1, 2...}, gives the number of tokens in each place. Define the PN transition vector, or x-vector, x to have dimension of T , and one element xi corresponding to each transition. Let the set of all transitions be

T = {x1 , x 2 ,...x L } . Then the transition vector has L elements. A set of m transitions {xik ∈ T | k = 1,2,..., m}

can be represented as an L-vector x having m entries x ik = 1 and zero entries otherwise. The well-known [Peterson 1981],

PN →

marking

transition

equation



m + ( p ) = m( p ) + W T x

(2)

gives the new marking vector m + ( p ) in terms of the previous marking vector m( p ) and the transitions that have fired appearing as 1’s in x. A p-invariant is defined as a set of resources and places that is in the null space of W. i.e. Wp=0.

(3)

Note that if p is a p-invariant, then

R1



B3

B2

B1 r1a b1 Pin

t2

t4

t3

t5

t12 Pout

r2b t9

R2

282

t10

m2 t7 M2

Fig. 3. FMRF system

b3

t8

t6

r2a

t1

r1b

m1 b2





p T m + ( p ) = p T m( p ) + p T W T x = p T m( p )

M1

t11

so that the number of tokens in a p-invariant is constant. One type of p-invariant is given by any resource plus all of its jobs, r ∪ J (r ) .

t13

E. Circular Blocking A circular blocking CB is a circular wait that is empty and will always remain so [Lewis et al. 1998, Mireles et al. 2002, Wysk et al. 1991]. That is, for a CW C= {ri}:

Prasanna Ballal, Abhishek Trivedi and Frank Lewis: Deadlock Avoidance Policy in Mobile Wireless Sensor Networks with Free Choice Resource Routing

1. m(C)=0, and 2. no tokens will ever be added to C. In this situation, one is said to have deadlock, where the resources in the CW are waiting for each other and will never again become available. If a resource on a given part path is involved in a CB, then all downstream activity along that part path will eventually end. That is, after some time, the downstream jobs on that part path will never again be performed. Let C ={Ci} be a set of disjoint CW. Then, C is said to be in CB if each CW Ci is in CB. F. Siphons The analysis of CB and deadlock can be carried out formally using the notion of siphon. A siphon is a set of places having the property that its input transition set is contained in its output transition set i.e.

•S ⊂ S •

(4)

A siphon has the key property that, once it is unmarked, it remains so. A minimal siphon of a CW C is the smallest siphon containing the CW. Define a critical siphon for a CW C as a smallest siphon which has the property that a CW is a CB if and only if the critical siphon is empty. It is shown in [Lewis et al. 1998, Mireles et al. 2002, Zhou et al. 2005] that a minimal siphon in MRF is a critical siphon. ∧

For MRF systems, for every CW C, the set of places S c defined by

A. FMRF Critical Siphons Let Cs be the set of all simple CWs in a FMRF system. Let p be a decision place with resource place rp=R(p). Define the set of all the simple CWs in Cs containing the decision resource rp as

C p = {C ∈ C s | r p ∈ C}

(6)

Given a CW C, let the set of its decision places be

J dec (C ) = { p ∈ J (C ) | p • > 1}

(7)

C p (C ) = {C p | p ∈ J dec (C )}

(8)

Define,

which is the key to deadlock analysis in FMRF systems. We need to recursively compute Cp(C), as each individual simple CW in Cp(C) defined in (8) may contain more decision resources, and so on as shown in Figure 4. Hence we need an algorithm to calculate Cp(C). Algorithm 1 shows a modified version of the greedy activity selector algorithm [Corman et al. 2001]. C4 C2 C1

C4

C5 C3 C6



S c = C ∪ J (C ) +

(5)

is a minimal siphon as well as a critical siphon, where J(C)+ was defined earlier [Mireles et al. 2002, Wysk et al. 1991]. In the case of FMRF systems, this object is still a minimal siphon, but it cannot be used in deadlock analysis due to decision places. Hence it is not a critical siphon. Following Lemmas are true for FMRF systems [Ballal et al. 2007]. ∧

Lemma 1: For FMRF systems, S c is a minimal siphon for ■

the CW C.

Fig. 4. Tree representation of simple CW dependence through decision places Algorithm 1: Compute Cp(C) for a CW C Given a CW C, 1. Calculate Cp(C) using Equation 8 2. x = 1 3. y = |CWr| (set of CW of resources -see Section 4) 4. For x  1: y If any r p ∈ (C x ⊂ C p (C )) ∉ C p (C ) \ C x (for each decision resource in the system)



Lemma 2: Let C be a simple CW and S c contain a decision place whose associated decision resource is not a ∧

shared resource, then Sc contains a p-invariant and can ■

never be empty. 3. Critical Siphons and Critical Subsystems for FMRF ∧

Lemma 1 shows that Sc given by (5) is indeed a minimal siphon, even for FMRF, but Lemma 2 shows that in some ∧

situations for FMRF, Sc

can never be empty. Since

deadlock can still occur in such situations, it is necessary to provide an alternative formula for critical siphons for FMRF.

Cp(C) = [Cp(C) ∪ Cp(Cx) ] ■ 5. Return Cp(C) Note that this algorithm computes the set Cp(C) for a single CW. The time complexity of this algorithm is known to be linear [Corman et al. 2001] as the running time is directly proportional to |CWr|. Hence, if Rn is the number of resources in FMRF, the complexity from step 4 to 5 is O(Rn × |CWr|). The complexity for computing Cp(C) for all the CWs in the system is O((Rn × |CWr|)2). This set is converted to a single row by using union of all the rows of Cp(C) (Explained in Sections 4 and 5). Also, when this algorithm terminates, Cp(C)=Cp(Cp(C)). This algorithm terminates in one of the two ways:

283

International Journal of Advanced Robotic Systems, Vol. 5, No. 3 (2008)

a. J (C p (C )) + ∩ J (C p (C )) 0 = φ or

4. Matrix Formulation for FMRF

b. J (C p (C )) + ∩ J (C p (C )) 0 ≠ φ . Given a CW C define the object,

S c = C p (C ) ∪ J (C p (C )) +

(9)

The next results from [Ballal et al. 2007] show that Sc is a critical siphon for C for FMRF systems under a certain condition. Theorem 1: Given Cp(C) and let J (C p (C )) + ∩ J (C p (C )) 0 = φ . Then Cp(C) is in CB if and only if Sc is empty. ■ Theorem 2: Let J (C p (C )) + ∩ J (C p (C )) 0 ≠ φ . Then Cp(C) can never be in CB. ■ Theorem 3: If J (C p (C )) + ∩ J (C p (C )) 0 = φ then CW C

PN provides great pictorial insight and mathematical techniques for analysis, but they have sometimes had the deficiency of not providing an efficient computational framework for simple computer-based analysis. A matrix framework for computing structural objects of a PN can correct these deficiencies [Lewis et al. 1998]. Note that the matrix formulation for PN objects is not the main contribution of this paper. Our main contribution resides in the matrix formulation of deadlock avoidance in FMRF systems. Commensurate with the partitioning P = J ∪ R ∪ PI ∪ PO with J, R, PI, and PO being the sets of job places, resource places, input places, and output places respectively, partition the place vector as

⎡v⎤ ⎢r ⎥ p=⎢ ⎥ ⎢ pi ⎥ ⎢ ⎥ ⎣ po ⎦



is in CB if and only if Cp(C) is in CB.

B. FMRF Critical Subsystems For better perspective on achieving dispatching policies with deadlock avoidance, the concept of critical subsystems [Lewis et al. 1998] is introduced. To avoid deadlock, work in progress (WIP) must be limited within certain critical subsystems that are constructed by using critical siphons, called MAXWIP. A critical subsystem for a CW C in MRF is defined as the set of J-places J(C)0. In case of FMRF, Critical Subsystem for a CW C can be defined if J (C p (C )) 0 ∩ J (C p (C )) + = φ and in this case it is defined as the set of J-places J(Cp(C))0. Define the set *

S c = S c ∪ J (C p (C )) 0 called the support of the binary p-invariant that minimally covers Sc. Then the following Lemmas are true [Ballal et al. 2007]. Lemma 3: In FMRF, a simple CW C is not in deadlock if *

and only if one has m(J(Cp(C))01 [(i,:) implies entire ith row] Cp(i,:)=CWr(i,:) end end Calculating Jdec(C) for i=1:|(CWr)| if max(CWr(i,:)*Sr*Fv)>1 Jdec(i,:)=CWr(i,:)*Sr*Fv end end for i=1:|Jdec| for j=1:|Jdec| if Jdec(i,j)=1 then Jdec(i,j)=0 end if Jdec(i,j)>1 then Jdec(i,j)=1 end end end Finding initial Cp(C) D=Cp*Sr*Fv m=1 for i=1:|(CWr)| if max(and(D(i,:),Jdec(i,:)))==1 Cp(C)((m,:))=CWr(i,:) m=m+1 end end



After computing Cp, Jdec(C) and the initial Cp(C) using Algorithm 2, we use Algorithm 1 to compute Cp(C) recursively. Note that Algorithm 1 only computes the set Cp(C) for a CW C under consideration. Then, this set is converted to a single row by using union of all the rows of Cp(C). The same procedure is followed for all the other CWs in the system using a simple ‘for loop’ to get the complete set Cp(C) for all the CWs in the system. The complexity of Algorithm 2 is O(|(CWr)|) as the running time is directly proportional to the number of CWs in the system. For calculating the same for all the CWs in the system, the complexity is O(|(CWr)|2).

285

International Journal of Advanced Robotic Systems, Vol. 5, No. 3 (2008)

C. Critical Siphons/ Critical Subsystems In Matrix Form In this section we use matrices to compute the PN objects i.e. Critical Siphons and Critical Subsystems required in Section 3 for deadlock analysis in FMRF systems.

Mission 1

Intruder detected by Sensor M0.

Task no.

Tasks to be done

• C and C • are the set of input and output transitions

Task 1 – b1a

from a CW C. Once CWr is constructed, we use Algorithm 2 and then Algorithm 1 to construct Cp(C) for each C ∈ CW r . Let •C p (C ) and C p (C ) • be the set of input

Garcia Robot (B1) goes to sensor M0 to verify data

Task 2, 3, 4 – m1, m2, m3 (Routing jobs)

Sensors M1, M2, M3 take sensor readings and send it to Garcia Robot (B1)

Task 5 – b1b

Garcia Robot (B1) goes to sensor M4 for relaying all the information

Task 6 - m4

Sensor M4 relays information to basestation

Output

Base-station makes decision and alerts the authorities

and output transitions from Cp(C). In matrix formulation, it is denoted as dCp(C) and Cp(C)d respectively. It is computed as: d

Cp(C)= Cp(C) ⊗ Sr

(13)

Cp(C)d=Cp(C) ⊗ FrT

(14)

To find the set of transitions CWt(Cp(C)) between resources in the set Cp(C), we use,

CWt (C p (C )) = d C p (C ) ⊗ C p (C ) d The critical subsystems J(Cp(C))0 given by,

(15) Table 1. Rule-Base for Mission in FMRF

for a given CWr are

J (C p (C )) 0 = CWt (C p (C )) ⊗ Fv

(16)

The siphon job sets J(Cp(C))+ are given by, J (C p (C )) + = d C p (C ) ⊗ ( d C p (C ) ⊗ C p (C ) d ) ⊗ Fv

localization of the mobile resources. All the resources can communicate with each other for transmisson of data to and from the base-station. Suppose the rule-base for this application is given as shown in Table 1. Figure 6 shows the Petri Net description of the rule-base described in Table 1.

(17)

Now we have all the formulations to compute using matrices the objects required for deadlock avoidance using Theorem 3 and Lemma 4. D. MAXWIP Dispatching Policy For Deadlock Avoidance In FMRF Lemma 4 formulates the MAXWIP dispatching policy for deadlock avoidance in FMRF systems. According to this policy, CB in FMRF is avoided by limiting WIP in the critical subsystems of each CW C. This policy can be implemented as a real-time deadlock avoidance control scheme by controlling the firing of the precedence transitions of the critical subsystems. 5. Implementation Results To show the effectiveness of the proposed strategy, an application scenario is discussed in this Section. A warehouse monitoring system is implemented at Automation and Robotics Research Institute (ARRI). The test-bed consists of an Acroname® Garcia robot which acts as a mobile resource while five Crossbow® Mica2 sensors act as stationary resources. The mobile robots are also endowed with Crossbow® sensors, so that we have a test-bed consisting of mobile and stationary sensors. Also, MIT cricket sensors (ultrasound ranging) are used for

286

Fig. 6. Petri Net for the Mission in Table 1 When the number of tasks and resources are increased, the formulation of the required system matrices becomes cumbersome. The LabVIEW® toolkit developed at ARRI generates the matrices with a default conflict resolution matrix automatically when the resources are assigned to the tasks. The user can either manually change the resource allocation or the resource allocation can be changed automatically. Figure 7 shows the front panel of the toolkit. The toolkit also generates the Petri Net for better visualization. We implement the same mission first without the deadlock avoidance algorithm. Here, we find that,

Prasanna Ballal, Abhishek Trivedi and Frank Lewis: Deadlock Avoidance Policy in Mobile Wireless Sensor Networks with Free Choice Resource Routing

B1 M1 M2 M3 M4

⎡1 ⎢1 ⎢ ⎢1 ⎢ CWr = ⎢1 ⎢1 ⎢ ⎢1 ⎢1 ⎣

B1 M1 M2 M3 M4

1 0 0 0⎤ ⎡1 ⎢1 0 1 0 0⎥⎥ ⎢ ⎢1 0 0 1 0⎥ ⎢ ⎥ 1 1 0 0⎥ C p (C ) = ⎢1 ⎢1 1 0 1 0⎥ ⎢ ⎥ 0 1 1 0⎥ ⎢1 ⎢1 ⎥ 1 1 1 0⎦ ⎣

1 1 1 0⎤ 1 1 1 0⎥⎥ 1 1 1 0⎥ ⎥ 1 1 1 0⎥ 1 1 1 0⎥ ⎥ 1 1 1 0⎥ 1 1 1 0⎥⎦

b1a m1 m2 m3 b1b m4

⎡0 ⎢0 ⎢ ⎢0 ⎢ J (C p (C )) + = ⎢0 ⎢0 ⎢ ⎢0 ⎢0 ⎣

0 0 0 1 0⎤ 0 0 0 1 0⎥⎥ 0 0 0 1 0⎥ ⎥ 0 0 0 1 0⎥ 0 0 0 1 0⎥ ⎥ 0 0 0 1 0⎥ 0 0 0 1 0⎥⎦

b1a m1 m2 m3 b1b m4

⎡1 ⎢1 ⎢ ⎢1 ⎢ J (C p (C )) 0 = ⎢1 ⎢1 ⎢ ⎢1 ⎢1 ⎣

1 1 1 0 0⎤ 1 1 1 0 0⎥⎥ 1 1 1 0 0⎥ ⎥ 1 1 1 0 0⎥ 1 1 1 0 0⎥ ⎥ 1 1 1 0 0⎥ 1 1 1 0 0⎥⎦

Fig. 8. Implementation without Deadlock Avoidance Here we see that J (C p (C )) + ∩ J (C p (C )) 0 = φ . Hence, when tokens are in the tasks b1a, m1, m2 and m3 at the same time, deadlock will occur as they form the critical subsystem. Hence, when the mission is triggered for the second time, as long as tasks m1, m2 and m3 are in progress and the token is in b1a, deadlock will occur, as shown in the implementation event trace timing diagram in Figure 8. The event trace timing diagram provides a good illustration of occurance of deadlocks in complicated systems and their avoidance e.g. see ([Giordano et al. 2206 and Mireles et al. 2002]). We see that the resources B1, M1, M2 and M3 are never released and hence the tasks b1b and m4 are never completed. The MAXWIP dispatching policy formulated for deadlock avoidance in FMRF systems avoids this deadlock by limiting the work in progress (WIP) in the critical subsystems of each CW. According to this policy, as long as the tasks m1, m2 and m3 are in progess, the task b1b is not allowed to start. Once the tasks m1, m2, and m3 are completed, the task b1b is allowed to start and deadlock is successfully avoided. The event trace timing diagram is shown in Figure 9.

Fig. 7. LabVIEW toolkit for PN and Matrices generation

287

International Journal of Advanced Robotic Systems, Vol. 5, No. 3 (2008)

deadlocks. There are other deadlock structures called second order deadlocks which occur due to the presence of key resources. Deadlock avoidance in FMRF in presence of key resources is part of our future work. 7. Acknowledgments This research was supported ARO grant DAAD 19-02-10366; ARO grant ARO W91NF-05-1-0314; NSF grant IIS0326505; NSF grant CNS-0421282, DOE/SBIR grant 263903-81, NI Lead User grant, Texas ARP grant 14748779. 8. References

Fig. 9. Implementation with Deadlock Avoidance From the Figure we can see that there is no deadlock in the system and all the tasks are performed correctly. 6. Conclusions Presence of shared resources and decision resources in a mobile wireless sensor network can create deadlocks. Such systems can be modeled as a FMRF system. A theory for deadlock avoidance in FMRF is provided in this paper. It is shown that the occurrence of decision places, which are followed by two or more resource paths, means that the usual notion of critical siphon used in MRF does not apply for FMRF. Therefore, we define a new notion of critical siphon for FMRF that is tied to deadlock avoidance. A MAXWIP dispatching policy is formulated for deadlock avoidance in FMRF systems. According to this policy, it has been shown that the work in progress (WIP) must be limited in the critical subsystems to avoid deadlock. A matrix formulation that efficiently computes the various PN objects required for deadlock avoidance in FMRF has been provided. This matrix formulation allows fast and efficient numerical computation techniques to be applied to PN analysis. An implementation which shows the efficiency of the proposed deadlock avoidance policy in Mobile WSN is provided. Note that this formulation is applicable to only first order

288

Ballal P, Lewis F., Mireles J., Sreenath K. (2007), "Deadlock avoidance for free choice multi-reentrant flow lines: Critical siphons and critical subsystems", Proc. Mediterranean Conf. Control & Automation, Athens, Greece, June 2007 Ballal P., Giordano V., Lewis F. (2006), "Deadlock Free Dynamic Resource Assignment in Multi-Robot Systems with Multiple Missions: A Matrix-Based Approach," Proceedings of Mediterranean Conference on Control & Automation, Ancona, Italy, June 2006. Butler Z., Rus D.(2003), “Event-based motion control for mobile-sensor network”, IEEE Transactions on Pervasive Computing, vol.2 issue 4, OctoberDecember 2003 Cortes J., Martinez S., Karatas T., Bullo F.(2004), “Coverage control for mobile sensing network”, IEEE Transactions on Robotics and Automation, Vol. 20, Issue 2, pp. 243–255, April 2004 Chong C., Kumar S.(2003), “Sensor Networks: Evolution, Opportunities and Challenges”, Proceedings of the IEEE, col. 91, no.8, August 2003 Corman, T., Leisenson, C., and Rivest R.(2001), Introduction to Algorithms, Prentice Hall of India, 2001. Dantu K., Rahimi M., Shah H., Babel S., Dhariwal A., Sukhatme G.(2005), “Robomote: enabling mobility in sensor networks”, Information Processing in Sensor Networks, 2005. IPSN 2005. Fourth International Symposium on 15 April 2005 Page(s):404 – 409 Ezpeleta, J.; Colom, J.M.; Martinez, J.(1995); “A Petri net based deadlock prevention policy for flexible manufacturing systems”, IEEE Transaction on Robotics and Automation, Volume 11, Issue 2, April 1995 Page(s):173 – 184 Ezpeleta J., Recalde L.(2002), “A deadlock avoidance approach for nonsequential resource allocation systems,” in Proc. IEEE Int Conf. Syst., Man, Cybern., Oct. 2002. Fanti, M. P., Maione, G. and Turchiano, B.(2001), “Distributed Event-Control for Deadlock Avoidance in Automated Manufacturing Systems,” International

Prasanna Ballal, Abhishek Trivedi and Frank Lewis: Deadlock Avoidance Policy in Mobile Wireless Sensor Networks with Free Choice Resource Routing

Journal of Production Research 39(9), 2001, Page(s): 1993-2021. Fanti, M.P.; Maione, B.; Turchiano, B.(2000);Comparing digraph and Petri net approaches to deadlock avoidance in FMS IEEE Transactions on Systems, Man and Cybernetics, Part B, Volume 30, Issue 5, Oct. 2000 Page(s):783 - 798 Fanti M., Zhou M.(2004), “Deadlock control methods in automated manufacturing systems,” IEEE Transactions on Systems, Man, and Cybernetics - Part A: Systems and Humans, 34(1):5-22, 2004. Gerkey B., Mataric M.(2002), “Sold! Auction methods for multirobot coordination”, IEEE Transactions on Robotics and Autoation, vol. 18, no. 5, October 2002 Gerkey B., Mataric M.(2004), “A formal analysis and taxonomy of task allocation in multi-robot systems”, Int. Journal of Robotics Research, vol.:18 , no.5 , September 2004 Giordano V., Ballal P., Lewis F., Turchiano B., Zhang J. B. (2006), “Supervisory Control of Mobile Sensor Networks: Math Formulation, Simulation, Implementation,” IEEE Transactions on Systems, Man and Cybernetics, Part B, Volume 36, Issue 4, Aug. 2006 Page(s):806 – 819. Giordano V., Lewis F., Mireles J.(2005), Turchiano B., “Coordination control policy for mobile sensor networks with shared heterogeneous resources”, Proceedings of the IEEE International Conference on Control and Automation, Budapest, June 2005 Giordano V., Lewis F., Turchaino B., Ballal P., Yeshala V.(2005), “Matrix Computational Framework for Discrete Event Control of Wireless Sensor Networks with Some Mobile Agents,” Proceedings of the Mediterranean Conference on Control & Automation, Limassol, Cyprus, June 2005. Gurel A., Bogdan S., Lewis F.(2000), “Matrix approach to deadlock-free dispatching in multi-class finite buffer flowlines”, IEEE Transactions on Automatic Control, Vol. 45, Issue 11, November 2000, pp.2086-2090 Judd R., Zhang W., Deering P., Lipset R., “A Scalable Deadlock Avoidance Algorithm for Flexible Manufacturing Systems with Free Choice in Part Routing,” Proceedings of IEEE American Control Conference, 2000. Lawley, M.(2000) “Integrating Routing Flexibility and Algebraic Deadlock Avoidance Policies in Automated Manufacturing Systems,” International Journal of Production Research, , 2000, Page(s): 2931-2950. Lewis F., Gurel A., Bogdan S., Docanalp A. Pastravanu O. (1998), “Analysis of deadlock and circular waits using a matrix model for flexible manufacturing systems”, Automatica, vol.34, no. 9, September 1998 Lewis F.(2004), “Wireless sensor networks,” Smart environments: Technologies, Protocols, and

Applications, ed. D. J. Cook and S. K.Das, John Wiley, New York, 2004. Maione G., Naso D.(2001), “ Modeling Evolutionary Supervisors for Multi-Agent Manufacturing Control with Discrete Event Formalism,” Proceedings of IEEE Mountain Workshop on Soft Computing in Industrial Applications SMCia/01, June 2001. Mireles J., Lewis F., Gurel A.(2002), “Implementation of a deadlock avoidance policy for multipart reentrant flow lines using a matrix-based discrete event controller”, Proceedings of the International symposium on advances in robot dynamics and control, New Orleans, November 2002 Murata, T.(1989), “Petri Nets: Properties, Analysis and Applications.” Proceedings of the IEEE, vol.77, no.4, April 1989, pp.541-80 Ozmutlu, S. And Harmonosky, C.M.(2005), “A Real Time Methodology for Minimizing Mean Flowtime in FMSs With Routing Flexibility: Threshold Based Alternate Routing,” European Journal of Operational Research, 2005, Pages(s): 369-384. Peterson, J. L.(1981), “Petri Net Theory and the Modeling of Systems,” Prentice-Hall, Englewood Cliffs, NJ, 1981. Piroddi L., Ferrarini L.(2005), “ A Modular Approach for Deadlock Avoidance in FMS,” Proceedings of IEEE Conference on Decision and Control, 2005. Puccinelli D., Haenggi M.(2005), “Wireless Sensor Networks: Applications and Challenges of Ubiquitous Sensing”, IEEE Circuits and Systems Magazine, vol. 5, pp. 19-29, August 2005. Reveliotis S.(2001), “On the Siphon-based Characterization of Liveness in Sequential Resource Allocation Systems,” Tech. Report, School of Industrial & Systems, Eng. Georgia Tech, 2001. Sinopoli B., Sharp C., Schenato L., Schaffert S., Sastry S.(2003), “Distributed Control Applications Within Sensor Networks”, Proceedings of the IEEE, vol. 91, no.8, August 2003 Tacconi D., Lewis F.(1997), “A new matrix model for discrete event systems: application to simulation”, IEEE Control System Magazine, vol.17 October 1997 Wysk, R.A.; Yang, N.S.; Joshi, S. (1991); “Detection of deadlocks in flexible manufacturing cells”, IEEE Transactions on Robotics and Automation, vol.:7 , Issue: 6 , December 1991 Xing K.Y., Hu B.S., Chen H.X. (1991), “Deadlock Avoidance Policy for Petri-net Modeling of Flexible Manufacturing Systems With Shared Resources,” IEEE Transactions on Automatic Control, Volume 41, Feb 1991 Page(s): 289-295. Xing K., Jin X., Feng Y.(2005), “ Deadlock Avoidance Petri Net Controller for Manufacturing Systems with

289

International Journal of Advanced Robotic Systems, Vol. 5, No. 3 (2008)

Multiple Resource Service,” Proceedings of IEEE Conference on Robotics and Automation, 2005.

290

Zhou M.C., Fanti M. P. (2005), Eds., “Deadlock Resolution in Computer-Integrated Systems,” New York: Marcel Dekker, 2005.

Suggest Documents