CMPSCI 521/621 HW6 Solutions

Similar documents
20b -Advanced-DFA. J. L. Peterson, "Petri Nets," Computing Surveys, 9 (3), September 1977, pp

Page # 20b -Advanced-DFA. Reading assignment. State Propagation. GEN and KILL sets. Data Flow Analysis

Relational String Verification Using Multitrack

Dr. D.M. Akbar Hussain

Model checking pushdown systems

Timo Latvala. January 28, 2004

1.3 Functions and Equivalence Relations 1.4 Languages

Regular Languages and Regular Expressions

CS5371 Theory of Computation. Lecture 8: Automata Theory VI (PDA, PDA = CFG)

Implementation of Lexical Analysis

Implementation of Lexical Analysis

Implementation of Lexical Analysis

ITEC2620 Introduction to Data Structures

MIT Specifying Languages with Regular Expressions and Context-Free Grammars. Martin Rinard Massachusetts Institute of Technology

Chapter 23. Linear Motion Motion of a Bug

MIT Specifying Languages with Regular Expressions and Context-Free Grammars

CS 314 Principles of Programming Languages. Lecture 3

Distributed Systems. Rik Sarkar James Cheney Global State & Distributed Debugging February 3, 2014

Implementation of Lexical Analysis. Lecture 4

T Reactive Systems: Kripke Structures and Automata

Extended Introduction to Computer Science CS1001.py. Lecture 5 Part A: Integer Representation (in Binary and other bases)

Chapter 3: Lexing and Parsing

Lexical Analysis. Implementation: Finite Automata

Petri Nets. Robert A. McGuigan, Department of Mathematics, Westfield State

CARLETON UNIVERSITY. Laboratory 2.0

ECE 341 Midterm Exam

CT32 COMPUTER NETWORKS DEC 2015

Outline. Petri nets. Introduction Examples Properties Analysis techniques. 1 EE249Fall04

HW/SW Codesign. WCET Analysis

Łabiak G., Miczulski P. (IIE, UZ, Zielona Góra, Poland)

IMPERATIVE PROGRAMS BEHAVIOR SIMULATION IN TERMS OF COMPOSITIONAL PETRI NETS

Clock Synchronization. Synchronization. Clock Synchronization Algorithms. Physical Clock Synchronization. Tanenbaum Chapter 6 plus additional papers

Zhizheng Zhang. Southeast University

2. Lexical Analysis! Prof. O. Nierstrasz!

Formal Languages and Compilers Lecture IV: Regular Languages and Finite. Finite Automata

CS 314 Principles of Programming Languages

COS 126 Written Exam 2 Spring 18

CMPSCI 250: Introduction to Computation. Lecture #36: State Elimination David Mix Barrington 23 April 2014

HKN CS 374 Midterm 1 Review. Tim Klem Noah Mathes Mahir Morshed

Increasing/Decreasing Behavior

Thompson groups, Cantor space, and foldings of de Bruijn graphs. Peter J. Cameron University of St Andrews

EECS 144/244: Fundamental Algorithms for System Modeling, Analysis, and Optimization

By: Chaitanya Settaluri Devendra Kalia

Lexical Analysis. Lecture 3-4

Formal Systems Tutorial Hybrid System Modeling, Program Analysis

Introduction to Dynamic Analysis

ECS 120 Lesson 7 Regular Expressions, Pt. 1

Sets 1. The things in a set are called the elements of it. If x is an element of the set S, we say

Languages and Compilers

Outline. 1 Scanning Tokens. 2 Regular Expresssions. 3 Finite State Automata

Implementation of Lexical Analysis

F. Wagner April 2003 revised April any Boolean expression can be represented by an OR combination of AND expressions

Computational Physics - Fortran February 1997

UNIT -2 LEXICAL ANALYSIS

SCHEME 8. 1 Introduction. 2 Primitives COMPUTER SCIENCE 61A. March 23, 2017

Lexical Analysis 1 / 52

LR Parsing, Part 2. Constructing Parse Tables. An NFA Recognizing Viable Prefixes. Computing the Closure. GOTO Function and DFA States

CS 403 Compiler Construction Lecture 3 Lexical Analysis [Based on Chapter 1, 2, 3 of Aho2]

lec3:nondeterministic finite state automata

Lecture 10: Nested Depth First Search, Counter- Example Generation Revisited, Bit-State Hashing, On-The-Fly Model Checking

Verteilte Systeme (Distributed Systems)

Formal Modeling of BPEL Workflows Including Fault and Compensation Handling

Faster Or-join Enactment for BPMN 2.0

6.1 Combinational Circuits. George Boole ( ) Claude Shannon ( )

CSE450. Translation of Programming Languages. Automata, Simple Language Design Principles

2010: Compilers REVIEW: REGULAR EXPRESSIONS HOW TO USE REGULAR EXPRESSIONS

CMPSCI 521/621 Homework 2 Solutions

Ch6 Protocol Testing. Outline. Outline. Protocol Conformance Testing. Introduction Concepts Fault models Related definitions General approach

Issues on Decentralized Consistency Checking of Multi-lateral Collaborations

Hardware-Software Codesign. 9. Worst Case Execution Time Analysis

13 th Annual Johns Hopkins Math Tournament Saturday, February 19, 2011 Automata Theory EUR solutions

Section 2.2: Introducing Permutations and Factorial Notation

One of the most important areas where quantifier logic is used is formal specification of computer programs.

ECE 341 Midterm Exam

Intro to Transaction Management

Increasing/Decreasing Behavior

Rational Numbers CHAPTER Introduction

Homework. Announcements. Before We Start. Languages. Plan for today. Chomsky Normal Form. Final Exam Dates have been announced

CS143 Midterm Fall 2008

CS Operating Systems

CS Operating Systems

Solve the Data Flow Problem

The SPIN Model Checker

Introduction to regular expressions

Definition: A context-free grammar (CFG) is a 4- tuple. variables = nonterminals, terminals, rules = productions,,

DISCRETE-event dynamic systems (DEDS) are dynamic

Lexical analysis. Syntactical analysis. Semantical analysis. Intermediate code generation. Optimization. Code generation. Target specific optimization

c. Typically results in an intractably large set of test cases even for small programs

2 Solution of Homework

3. Syntax Analysis. Andrea Polini. Formal Languages and Compilers Master in Computer Science University of Camerino

A Schedulability-Preserving Transformation Scheme from Boolean- Controlled Dataflow Networks to Petri Nets

Introduction to Lexical Analysis

A Deterministic Concurrent Language for Embedded Systems

Lexical Analysis. Lecture 2-4

Garrett Hall CSC 173 C Programming Weeks 3-4

Introduction to Computers & Programming

Introduction to Automata Theory. BİL405 - Automata Theory and Formal Languages 1

Decimal Binary Conversion Decimal Binary Place Value = 13 (Base 10) becomes = 1101 (Base 2).

Formal Languages and Compilers Lecture VI: Lexical Analysis

Counting multiplicity over infinite alphabets

Transcription:

CMPSCI 521/621 HW6 Solutions Problem 1 (based on Xiang Zhao s solution). The node labels are an ordered pair that indicates the location of the program counter in the two different tasks. The first element in a pair corresponds to the location of the program counter in Task2 1 and the second element corresponds to the location of the program counter in Task 2. R(x,y) means a rendezvous between node x Task 1 and node y in Task 2. The notation b x means that a task is blocked at node x. 1

Problem 2 (based on Xiang Zhao s solution). Initially, there is one token at P0 and one token at P5. Note, there are 3 transitions out of P1 to represent the fact that Task 1 can synchronize with Task 2 in the following ways: statement 2 at Task 1 with statement 5 at Task 2 statement 2 at Task 1 with statement 6 at Task 2 statement 3 at Task 1 with statement 7 at Task 2 Also, pay attention to the transitions out of P2 and P3. They represent the fact that after Task 1 has synchronized with Task 2, Task 1 can either end (the downwards pointing transitions) or loop (the upwards pointing transitions). 2

Problem 3 INCA equations Task Flow Equations: x1 = 1 x7 = 1 x8 = 1 x13 = 1 x1 + x6 = x2 + x3 x2 = x4 x3 = x5 x4 + x5 = x7 + x6 x8 = x9 + x10 x9 = x11 x10 = x12 x11 + x12 = x13 Inter-Task Flow Equations x4 = x9 + x10 + x11 x5 = x12 Non-Negative Flow Equations j : x j 0 Property equation x4 = x4 The complement of the property is x4 x5, which is equivalent to x4 > x5 x4 < x5. Thus, any solution to x4 > x5 combined with the Task, Inter-Task and Non-Negative Flow equations will correspond to a property violation. Similarly, any solution to x4 < x5 combined with the Task, Inter-Task and Non-Negative Flow equations will correspond to a property violation. A solution that satisfies x4 > x5 combined with the Task, Inter-Task and Non-Negative Flow equations 3

is: x1 = x6 = x7 = x8 = x9 = x11 = x13 = 1 x3 = x5 = x10 = x12 = 0 x2 = x4 = 2 A counter example path that corresponds to this solution is Task 1: start, 1, 2, 4, 1, 2, 4, end. Task 2: start, 5, 6, 8, end. The rendezvous between b and b happens 1 times and the rendezvous between a and a happens 0 times, therefore the property is violated. Problem 4 (based on Xiang Zhao s solution). The CFG and the constraint are shown above. The CFG is annotated with the IN and OUT sets that are computed after state propagation has reached a fixed point. Each element in the IN/OUT sets is a tuple 4

of the form < x, y >, where x represents a state from the property automaton and y represents a state from the constraint automaton shown above. The tuples that are crossed out represent situations when the constraint automaton transitions to a violation state. This situations correspond to infeasible paths (e.g., on the same execution, the truth branch at node 3 is taken and then later the false one is taken, or vice versa). To determine if the property holds, we look at the OUT set of the final node and consider only the tuples in which the constraint automaton is in an accepting state. (In this example, the constraint automaton is in an accepting state (u, f, t) in all tuples). For these tuples, we then check if the property automaton is in an accepting state or not. If it is, the property holds; if there is at least one tuple in which the constraint is in an accepting state and the property is in a non-accepting state, then the property is violated. In this example, the property is satisfied since in all the tuples in the OUT set of the final node, the property and the constraint automata are in an accepting state. Problem 5 Reachability Graph (based on Brandon McPhail s solution and his (and his wife s) imagination.) Happy Holidays!!! 1,5a' r(2a,5a') 3b,5a' 2,6a' 4,5 2,7b' b4,5a' Second iteration 1,5 4,6a' 4,7b' end,5 b-end,5a' b1,5a' 2a,5 1,6a' 1,7b' 3b,5 end,6a' end,7b' r(b2a,5a') b3b,5a' a4,5 2a,7b' r(2a,6a') r(3b,7b') 3b,6a' r(b2,7b') b2,6a' b4,5 bb4,5a' a1,5 a4,7b' a-end, 5 r(a4,6a') 4,6 2,8 3,8 4,7 r(b4,7b') b-end, b4,6a' b1,5' b4,6a' 5 bb1,5a' bb-end, 5a' a1,7b' a-end, 7b' a-end, 7b' r(a-end, 6a') 1,6 end,6 2,end 4,8 3,end end,7 1,7 b1,6a' r(b-end, 7b') b-end, 6a' b1,6a' 1,8 end,8 4,end end,end 1,end To reduce some visual clutter, the reachability graph starts at the point where Task 1 is at statement 1 and Task 2 is at statement 5 a (nothing really interesting happens before Task 1 and Task 2 reach that point). 5

Notation: Dotted transitions and nodes indicate the situation where the Task 1 is about to start a second iteration of the loop from statement 4 to statement 1. The reachability graph is cut at that point since the problem specified that the loop can be taken at most one time. If a message is sent by one task but not immediately received by the other, a letter is used as a prefix before the task number to indicate that a receipt is pending. For example, b4, 5a means that task 1 is in statement 4, it has sent message b earlier but b has not been received by task 2 yet, and task 2 is at statement 5 waiting to receive a. The states with a doubled boundary indicate where deadlocks might occur. Petri Net (based on Stephan Moczygemba s solution) 6