1 Concurrency Specification. 2 Outline 4 Issues in concurrent systems 4 Programming language support for concurrency 4 Concurrency analysis - A specification.

Slides:



Advertisements
Similar presentations
1 Interprocess Communication 1. Ways of passing information 2. Guarded critical activities (e.g. updating shared data) 3. Proper sequencing in case of.
Advertisements

Tintu David Joy. Agenda Motivation Better Verification Through Symmetry-basic idea Structural Symmetry and Multiprocessor Systems Mur ϕ verification system.
A Technique for Parallel Reachability Analysis of Java Programs Raghuraman R. Sridhar Iyer G. Sajith.
Operating Systems Mehdi Naghavi Winter 1385.
Operating Systems Lecture Notes Deadlocks Matthew Dailey Some material © Silberschatz, Galvin, and Gagne, 2002.
Concurrency Important and difficult (Ada slides copied from Ed Schonberg)
UPPAAL Introduction Chien-Liang Chen.
Chapter 6: Process Synchronization
Requirements on the Execution of Kahn Process Networks Marc Geilen and Twan Basten 11 April 2003 /e.
Chapter 6 Process Synchronization: Part 2. Problems with Semaphores Correct use of semaphore operations may not be easy: –Suppose semaphore variable called.
Monitors Chapter 7. The semaphore is a low-level primitive because it is unstructured. If we were to build a large system using semaphores alone, the.
Atomicity in Multi-Threaded Programs Prachi Tiwari University of California, Santa Cruz CMPS 203 Programming Languages, Fall 2004.
C. FlanaganSAS’04: Type Inference Against Races1 Type Inference Against Races Cormac Flanagan UC Santa Cruz Stephen N. Freund Williams College.
Concurrent Processes Lecture 5. Introduction Modern operating systems can handle more than one process at a time System scheduler manages processes and.
Chapter 6: Process Synchronization. Outline Background Critical-Section Problem Peterson’s Solution Synchronization Hardware Semaphores Classic Problems.
Concurrency: Deadlock and Starvation Chapter 6. Revision Describe three necessary conditions for deadlock Which condition is the result of the three necessary.
Concurrency CS 510: Programming Languages David Walker.
UCoM Software Architecture Universal Communicator Research UCoM Programming Model The Problem  Multi-threaded code is difficult to write.
Application architectures
Software Engineering, COMP201 Slide 1 Protocol Engineering Protocol Specification using CFSM model Lecture 30.
Models of Computation for Embedded System Design Alvise Bonivento.
Process Synchronization
Chapter 11: Distributed Processing Parallel programming Principles of parallel programming languages Concurrent execution –Programming constructs –Guarded.
02/23/2004CSCI 315 Operating Systems Design1 Process Synchronization Notice: The slides for this lecture have been largely based on those accompanying.
A. Frank - P. Weisberg Operating Systems Introduction to Tasks/Threads.
Database Management Systems (DBMS)
Application architectures
A Usable Reachability Analyser Victor Khomenko Newcastle University.
CS 153 Design of Operating Systems Spring 2015 Lecture 11: Scheduling & Deadlock.
Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Proof Carrying Code Zhiwei Lin. Outline Proof-Carrying Code The Design and Implementation of a Certifying Compiler A Proof – Carrying Code Architecture.
Java Threads 11 Threading and Concurrent Programming in Java Introduction and Definitions D.W. Denbo Introduction and Definitions D.W. Denbo.
CS6133 Software Specification and Verification
Joseph Cordina 1/11 The Use of Model-Checking for the Verification of Concurrent Algorithms Joseph Cordina Department of C.S.&A.I.
ABSTRACT The real world is concurrent. Several things may happen at the same time. Computer systems must increasingly contend with concurrent applications.
1 Concurrency Architecture Types Tasks Synchronization –Semaphores –Monitors –Message Passing Concurrency in Ada Java Threads.
Using a simple Rendez-Vous mechanism in Java
Shared Memory Consistency Models. SMP systems support shared memory abstraction: all processors see the whole memory and can perform memory operations.
CY2003 Computer Systems Lecture 04 Interprocess Communication.
Consider the program fragment below left. Assume that the program containing this fragment executes t1() and t2() on separate threads running on separate.
1 Interprocess Communication (IPC) - Outline Problem: Race condition Solution: Mutual exclusion –Disabling interrupts; –Lock variables; –Strict alternation.
CSCI1600: Embedded and Real Time Software Lecture 11: Modeling IV: Concurrency Steven Reiss, Fall 2015.
Copyright © Curt Hill Concurrent Execution An Overview for Database.
Debugging Threaded Applications By Andrew Binstock CMPS Parallel.
ICFEM 2002, Shanghai Reasoning about Hardware and Software Memory Models Abhik Roychoudhury School of Computing National University of Singapore.
13-1 Chapter 13 Concurrency Topics Introduction Introduction to Subprogram-Level Concurrency Semaphores Monitors Message Passing Java Threads C# Threads.
Deadlock cs550 Operating Systems David Monismith.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
Software Systems Verification and Validation Laboratory Assignment 4 Model checking Assignment date: Lab 4 Delivery date: Lab 4, 5.
Specifying Multithreaded Java semantics for Program Verification Abhik Roychoudhury National University of Singapore (Joint work with Tulika Mitra)
SystemC Semantics by Actors and Reduction Techniques in Model Checking Marjan Sirjani Formal Methods Lab, ECE Dept. University of Tehran, Iran MoCC 2008.
Agenda  Quick Review  Finish Introduction  Java Threads.
Reachability Testing of Concurrent Programs1 Reachability Testing of Concurrent Programs Richard Carver, GMU Yu Lei, UTA.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 5: Process Synchronization.
Semaphores Chapter 6. Semaphores are a simple, but successful and widely used, construct.
Application architectures Advisor : Dr. Moneer Al_Mekhlafi By : Ahmed AbdAllah Al_Homaidi.
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D.
Victor Khomenko Newcastle University
Chapter 5: Process Synchronization – Part 3
Classical Synchronization Problems
Concurrency Specification
MODERN OPERATING SYSTEMS Third Edition ANDREW S
Monitors Chapter 7.
Lecture 25 Syed Mansoor Sarwar
Process Synchronization
Monitors Chapter 7.
Monitors Chapter 7.
CSE 542: Operating Systems
CSE 542: Operating Systems
Presentation transcript:

1 Concurrency Specification

2 Outline 4 Issues in concurrent systems 4 Programming language support for concurrency 4 Concurrency analysis - A specification based approach 4 Concurrency and other formal methods 4 Deadlock checker 4 Concurrency and architectures

3 Concurrency 4 Coexistence 4 Sharing of resources 4 Issues – Asynchronicity – Non-determinism 4 Solution – Locks 4 Results – Deadlock and starvation

4 Concurrency in Various Disciplines 4 Databases – Transaction serializability 4 Operating systems – Multithreading 4 Electronic circuits – Flip flops 4 Real life – Gas station example

5 Concurrency in Architecture Implementations

6 PL Support for Concurrency Fork and join constructs 4 Queue construct and the signal operation – Concurrent Pascal 4 The Java synchronized keyword

7 PL Support for Concurrency Communicating sequential processes [CSP] – Producer command : consumer!m – Consumer command : producer?n – Guarded commands —› guard : list of declarations, boolean expressions or an input command Alternative guarded command –[ G1 —› C1 ƀ G2 —› C2 ƀ …. ƀ Gn —› Cn]

8 From Specification to Implementation Specification Phase Implementation Phase 4 Easy to verify safety Difficult to verify and liveness safety and liveness 4 State spaces small State spaces and manageable large and unmanageable; testing difficult 4 Cost of correcting Cost of correcting flaws is low flaws is high

9 Specification-Based Model Synchronizer construct – Set of variables defining the state of shared resources – Set of operations on these variables (with pre/post conditions) – Set of invariants Safety conditions Liveness conditions

10 Specification-Based Model Process construct – Independent thread of execution – Multiple processes coexist – Control allocation/deallocation of synchronizer controlled resources 4 Example: – Web server : synchronizer – Web browser : process

11 Gas-Station Model

12 Gas-Station Model - Program Spec

13 Gas Station Model - RSTG

14 Gas Station Model - Event Expressions [ Two customers trying to buy gas concurrently

15 Gas Station Model - Reachability Graph 4 Identifies the states that can be reached by executing enabled operations in processes and synchronizers 4 Constructed from event expressions and RSTG – Nodes represent states of RSTG – Edges represent operations from event expressions 4 A deadlock occurs if the graph contains terminal nodes

16 Tool Support for Concurrency Analysis 4 INCA (Inequality Necessary Condition Analysis) – Checks properties of an architectural specification (e.g. mutual exclusion) – Provides example executions that violate those properties – Verifies that a modification removes the faults

17 Detecting a Race Condition 4 Customer1 pays before Customer2 but Customer2 takes up the hose before Customer1 thus getting the amount of gas purchased by Customer1

18 The INCA Query

19 INCA Results 4 INCA generates a system of inequalities based on the violation of properties specified by the query – A consistent inequality implies such a situation is possible – An inconsistent inequality implies such a situation is impossible

20 Features Common with Other Formal Methods 4 RSTG 4 Pre and post conditions 4 State invariants

21 Unique Features Operation execution phases – Request phase – Enabled phase – Service phase Only one operation invocation can be in the service phase – Terminate phase H Example: Fair scheduler []<>enabled(o) -> <>service(o)

22 Unique Features Separation of control resources from state variables 4 Event expressions help “walk through” the concurrency aspect 4 Semantics of allocation and deallocation – Helpful in detecting deadlocks

23 Deadlock Checker 4 Performs checks on parallel programs written in CSP in order to prove freedom from deadlock 4 Takes in a network file (.net) that has been compiled from a CSP source file using a tool such as FDR

24 The Dining Philosophers Problem 4 5 philosophers and 5 chopsticks 4 All philosophers keep thinking 4 When a philosopher feels hungry, he picks up the chopsticks closest to him, eats rice and keeps the chopsticks back 4 Deadlock: – When all philosophers grab their left chopstick simultaneously

25 The Dining Philosophers Problem

26 Architectures and Concurrency 4 Component types: – Synchronizer – Process units 4 Connector – Synchronization connector

27 Synchronization Connector

28 Conclusions and Discussion 4 Analysis of concurrent systems early in the development process reduces complexity and cost of correcting errors 4 A formal analysis will help detect deadlocks and starvation and also in direct code generation 4 Concurrency in software architectures can be represented in terms of CSPs