Presentation is loading. Please wait.

Presentation is loading. Please wait.

Banker’s Algorithm Implementation in CPN Tools Michal Žarnay Department of Transportation Networks University of Žilina, Slovakia.

Similar presentations


Presentation on theme: "Banker’s Algorithm Implementation in CPN Tools Michal Žarnay Department of Transportation Networks University of Žilina, Slovakia."— Presentation transcript:

1 Banker’s Algorithm Implementation in CPN Tools Michal Žarnay Department of Transportation Networks University of Žilina, Slovakia

2 University of Žilina Dept. of Transportation Networks CPN'08 Workshop 2 Outline Background Banker’s algorithm: modifications and implementation Analysis results and conclusion

3 University of Žilina Dept. of Transportation Networks CPN'08 Workshop 3 Background Simulation of large and complex logistic nodes using ABAsim architecture Deadlock states occur Over one hundred resources Automatic instead of human control Tenths of processes at the same time

4 University of Žilina Dept. of Transportation Networks CPN'08 Workshop 4 Resource Allocation System (RAS) ProcessesResources Limited number Used repeatedly Running concurrentlyAllocated exclusively

5 RAS: Modelling in CPN

6 Process Subnet

7 Resource Subnet

8 University of Žilina Dept. of Transportation Networks CPN'08 Workshop 8 Used Category of RAS Processes have properties: Flexible routing Use of multiple resource types at once Concurrent processing

9 Branches of Concurrent Processing

10 University of Žilina Dept. of Transportation Networks CPN'08 Workshop 10 Variants of Flexible Routing

11 University of Žilina Dept. of Transportation Networks CPN'08 Workshop 11 Process and Resource Instances

12 University of Žilina Dept. of Transportation Networks CPN'08 Workshop 12 Deadlock-Avoidance Policy (DAP) Processes combine concurrent processing and flexible routing Chosen: Banker’s algorithm DAP for such a RAS not found

13 University of Žilina Dept. of Transportation Networks CPN'08 Workshop 13 Banker’s Algorithm (BA) Using information about current system state it attempts to order running process instances in a sequence, so they can be finished State is not ordered State may (not) be safe State is safe State is ordered Success? +–

14 Assigning at T7 Request of P2: (0,-1,1) AllocatedNeededAvailable R1R2R3R1R2R3R1R2R3 P1 021011202 P2 110022 AllocatedNeededAvailable R1R2R3R1R2R3R1R2R3 P1 021011211 P2 101021 Ordered state:

15 University of Žilina Dept. of Transportation Networks CPN'08 Workshop 15 Unsafe states BA Principle Deadlock states Safe states States ordered by BA

16 University of Žilina Dept. of Transportation Networks CPN'08 Workshop 16 Tasks 1.Modify an available version of BA to suit the needs 2.Implement it 3.Test the BA on a model with outlined properties

17 University of Žilina Dept. of Transportation Networks CPN'08 Workshop 17 Why Choosing CPN Tools? Fast construction of the model in Petri nets Facilities for qualitative analysis of the model Availability of language for the BA implementation

18 University of Žilina Dept. of Transportation Networks CPN'08 Workshop 18 Outline Background Banker’s algorithm: modifications and implementation Analysis results and conclusion

19 University of Žilina Dept. of Transportation Networks CPN'08 Workshop 19 Original Data Structures For process instances: –Allocated resource units to process instances –Needed resource units to finish process instances –Available resource units in the system Overall –Set of all process instances –Set of all resource instances

20 University of Žilina Dept. of Transportation Networks CPN'08 Workshop 20 Original Algorithm On entering, each process instance declares the maximum number of units of each resource type needed for its execution Elaborated versions: supportive routines update the number of remaining needed resources on the run – information related to process stages

21

22 University of Žilina Dept. of Transportation Networks CPN'08 Workshop 22 Modifications of BA Needed renamed to RemainingNeeded Change information not fixed to process stages, but relative to it => Change – vector of relative changes for all resource types –Bits encoding –Primary and other descriptions

23 University of Žilina Dept. of Transportation Networks CPN'08 Workshop 23 Bits Encoding 00010010 162 –18 – – 12– 3 released 2 planned for re-allocation 00010010 162 18 12 2 assigned

24 BA: 12 Functions in CPN ML Links represent calls to functions

25 University of Žilina Dept. of Transportation Networks CPN'08 Workshop 25 Adding BA to CPN Model Adding one place Adding arcs Editing transition guards

26 A dedicated fusion place linked to transitions via a pair of arcs

27 input data output data after the change

28 Allocation No allocation BA is called only by an allocation request (7 from 9 transitions)

29 Change from primary to secondary variant Specific update, when changing the variants

30 University of Žilina Dept. of Transportation Networks CPN'08 Workshop 30 Outline Background Banker’s algorithm: modifications and implementation Analysis results and conclusion

31 University of Žilina Dept. of Transportation Networks CPN'08 Workshop 31 Analysis via CPN Tools Main criterion: number of deadlock states in the occurrence graphs of 2 models: –without BA –with BA Validation and verification phases: –All transitions occurring in the model without BA must occur in the model with BA –All reachable markings must form a home space Restriction of state space by BA

32 University of Žilina Dept. of Transportation Networks CPN'08 Workshop 32 Analysis Results Banker’s algorithm –Avoids deadlock states –Does not influence behaviour of the model inappropriately –Restricts the state space Model version State space Deadlock statesStatesTransitions Without BA12152378 With BA0113260

33 University of Žilina Dept. of Transportation Networks CPN'08 Workshop 33 Benefits Banker’s algorithm works for the outlined RAS with processes containing at the same time: –Concurrent processing –Flexible routing –Use of multiple resource types at once CPN Tools – integration of the properties: –Fast construction of the model in Petri nets –Facilities for qualitative analysis of the model –Availability of language for the BA implementation

34 University of Žilina Dept. of Transportation Networks CPN'08 Workshop 34 Shortcomings Implementation of BA in 12 CPN ML functions is rather complicated compared to sequential programming Use of external routines? Maintaining information about global states makes the CPN more difficult to read Use of hierarchy

35 University of Žilina Dept. of Transportation Networks CPN'08 Workshop 35 Further Issues Complex models produce too large state spaces –Algorithm should be effective – verify it! –Challenge: How to make its run more effective for such systems? More complicated way of allocation and release of resources – already implemented and requires further testing More complicated versions of BA – are they effective and beneficial for our purpose?

36 Thank you for your attention! Michal.Zarnay@fri.uniza.sk

37 University of Žilina Dept. of Transportation Networks CPN'08 Workshop 37 AllocatedNeededAvailable R1R2R3R1R2R3R1R2R3 P1211020010 P2112010 P3101200 P4101002


Download ppt "Banker’s Algorithm Implementation in CPN Tools Michal Žarnay Department of Transportation Networks University of Žilina, Slovakia."

Similar presentations


Ads by Google