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

Slides:



Advertisements
Similar presentations
Tintu David Joy. Agenda Motivation Better Verification Through Symmetry-basic idea Structural Symmetry and Multiprocessor Systems Mur ϕ verification system.
Advertisements

1 Concurrency: Deadlock and Starvation Chapter 6.
Deadlock and Starvation
Concurrency: Deadlock and Starvation Chapter 6. Deadlock Permanent blocking of a set of processes that either compete for system resources or communicate.
Lecture 7: Deadlock     Necessary Conditions for Deadlock     Deadlock Prevention - Havender's Linear Ordering Deadlock Avoidance Deadlock Detection &
Chapter 7: Deadlocks.
1 Concurrency Specification. 2 Outline 4 Issues in concurrent systems 4 Programming language support for concurrency 4 Concurrency analysis - A specification.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 7: Deadlocks.
Chapter 7: Deadlocks (Continuation). 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 14, 2005 Chapter 7: Deadlocks.
EEE 435 Principles of Operating Systems Deadlock Avoidance, Prevention, and Wrap-Up (Modern Operating Systems 3.5, 3.6, and 3.7)
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 6 Deadlocks Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All.
Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 Deadlocks  (How to Detect Them and Avoid Them) A:
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 7: Deadlocks.
DPNM Lab. Dept. of CSE, POSTECH
Synthesis of Embedded Software Using Free-Choice Petri Nets.
Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic.
Chapter 7: Deadlocks. 7.2 Chapter Objectives To develop a description of deadlocks, which prevent sets of concurrent processes from completing their tasks.
1 Chapter 7: Deadlock. 2 The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance.
CPN Models of Transport Systems Michal Zarnay Slovakia.
Models of Computation for Embedded System Design Alvise Bonivento.
02/19/2008CSCI 315 Operating Systems Design1 Deadlock Notice: The slides for this lecture have been largely based on those accompanying the textbook Operating.
Modeling State-Dependent Objects Using Colored Petri Nets
1 Concurrency: Deadlock and Starvation Chapter 6.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 14, 2005 Chapter 7: Deadlocks The Deadlock.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 7: Deadlocks.
Deadlocks Gordon College Stephen Brinton. Deadlock Overview The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks.
-Nikhil Bhatia 28 th October What is RUP? Central Elements of RUP Project Lifecycle Phases Six Engineering Disciplines Three Supporting Disciplines.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Deadlocks.
Kurt Jensen Lars M. Kristensen 1 Coloured Petri Nets Department of Computer Science Coloured Petri Nets Modelling and Validation of Concurrent Systems.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 7: Deadlocks Modified.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 7: Deadlocks.
Chapter 7 Deadlocks. 7.2 Modified By Dr. Khaled Wassif Operating System Concepts – 7 th Edition Silberschatz, Galvin and Gagne ©2005 Chapter 7: Deadlocks.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-6 Deadlocks Department of Computer Science and Software Engineering.
1 MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 6 Deadlocks Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 7: Deadlocks.
 The Deadlock Problem  System Model  Deadlock Characterization  Methods for Handling Deadlocks  Deadlock Prevention  Deadlock Avoidance  Deadlock.
Dr. Kalpakis CMSC 421, Operating Systems Deadlocks.
Deadlocks. What is a Deadlock “A set of processes is deadlocked if each process in the set is waiting for an event that only another process in the set.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 7: Deadlocks System Model Deadlock Characterization Methods.
Lecture 12 Handling Deadlock – Prevention, avoidance and detection.
Theory-Aided Model Checking of Concurrent Transition Systems Guy Katz, Clark Barrett, David Harel New York University Weizmann Institute of Science.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 7 Operating Systems.
Operating Systems Unit VI Deadlocks and Protection Department of Computer Science Engineering and Information Technology.
Chapter 8 Deadlocks. Objective System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection.
Chapter 7: Deadlocks. 7.2CSCI 380 – Operating Systems Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling.
Chap 7 Deadlocks. Chapter Objectives To develop a description of deadlocks, which prevent sets of concurrent processes from completing their tasks To.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 6 Deadlocks Slide 1 Chapter 6 Deadlocks.
7.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 7: Deadlocks.
Silberschatz, Galvin and Gagne ©2009 Edited by Khoury, 2015 Operating System Concepts – 9 th Edition, Chapter 7: Deadlocks.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock.
Chapter 7: Deadlocks. 7.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 14, 2005 Chapter 7: Deadlocks The Deadlock.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 7: Deadlocks.
Chapter 7: Deadlocks.
OPERATING SYSTEM CONCEPTS AND PRACTISE
Process Management Deadlocks.
TensorFlow– A system for large-scale machine learning
MODERN OPERATING SYSTEMS Third Edition ANDREW S
ITEC 202 Operating Systems
ICS 143 Principles of Operating Systems
Deadlocks Definition A set of processes is in a Deadlock state when every process in the set is waiting for an event that can only be caused by another.
Deadlock B.Ramamurthy CSE421 1/11/2019 B.Ramamurthy.
MODERN OPERATING SYSTEMS Third Edition ANDREW S
Deadlock B.Ramamurthy CSE421 2/23/2019 B.Ramamurthy.
Deadlock B.Ramamurthy CSE421 4/23/2019 B.Ramamurthy.
Deadlock B.Ramamurthy CSE421 5/1/2019 B.Ramamurthy.
Fast Min-Register Retiming Through Binary Max-Flow
Chapter 7: Deadlocks.
Deadlock B.Ramamurthy CSE421 8/28/2019 B.Ramamurthy.
Deadlock B.Ramamurthy CSE421 9/3/2019 B.Ramamurthy.
MODERN OPERATING SYSTEMS Third Edition ANDREW S
Presentation transcript:

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

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

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

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

RAS: Modelling in CPN

Process Subnet

Resource Subnet

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

Branches of Concurrent Processing

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

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

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

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? +–

Assigning at T7 Request of P2: (0,-1,1) AllocatedNeededAvailable R1R2R3R1R2R3R1R2R3 P P AllocatedNeededAvailable R1R2R3R1R2R3R1R2R3 P P Ordered state:

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

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

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

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

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

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

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

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

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

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

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

input data output data after the change

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

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

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

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

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 BA With BA

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

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

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?

Thank you for your attention!

University of Žilina Dept. of Transportation Networks CPN'08 Workshop 37 AllocatedNeededAvailable R1R2R3R1R2R3R1R2R3 P P P P