Aquinas Hobor and Cristian Gherghina (National University of Singapore) TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.:

Slides:



Advertisements
Similar presentations
Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Advertisements

Implementation and Verification of a Cache Coherence protocol using Spin Steven Farago.
CommUnity, Tiles and Connectors joint work with Roberto Bruni José Luiz Fiadeiro Antónia Lopes Ugo Montanari Ivan Lanese Dipartimento di Informatica Università.
Partial Order Reduction: Main Idea
Comparing Semantic and Syntactic Methods in Mechanized Proof Frameworks C.J. Bell, Robert Dockins, Aquinas Hobor, Andrew W. Appel, David Walker 1.
ICE1341 Programming Languages Spring 2005 Lecture #6 Lecture #6 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University.
Introducing Formal Methods, Module 1, Version 1.1, Oct., Formal Specification and Analytical Verification L 5.
Program correctness The State-transition model A global state S  s 0 x s 1 x … x s m {s k = local state of process k} S0  S1  S2  … Each state transition.
1 Regression-Verification Benny Godlin Ofer Strichman Technion.
Give qualifications of instructors: DAP
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 11.
Mutual Exclusion By Shiran Mizrahi. Critical Section class Counter { private int value = 1; //counter starts at one public Counter(int c) { //constructor.
Chapter 6 Process Synchronization Bernard Chen Spring 2007.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 5: Process Synchronization.
Time Bounds for General Function Pointers Robert Dockins and Aquinas Hobor (Princeton University) (NUS) TexPoint fonts used in EMF. Read the TexPoint manual.
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages Chapter 3 : Describing Syntax and Semantics Axiomatic Semantics.
ISBN Chapter 3 Describing Syntax and Semantics.
Simple Example {i = 0} j := i * i {j < 100} Can we ‘verify’ this triple? Only if we know the semantics of assignment.
CS 151 Digital Systems Design Lecture 37 Register Transfer Level
Ordering and Consistent Cuts Presented By Biswanath Panda.
ESC Java. Static Analysis Spectrum Power Cost Type checking Data-flow analysis Model checking Program verification AutomatedManual ESC.
CPSC 322, Lecture 12Slide 1 CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12 (Textbook Chpt ) January, 29, 2010.
Axiomatic Semantics Dr. M Al-Mulhem ICS
On the Relationship Between Concurrent Separation Logic and Assume-Guarantee Reasoning Xinyu Feng Yale University Joint work with Rodrigo Ferreira and.
Dr. Muhammed Al-Mulhem 1ICS ICS 535 Design and Implementation of Programming Languages Part 1 Fundamentals (Chapter 4) Axiomatic Semantics ICS 535.
1 Sharing Objects – Ch. 3 Visibility What is the source of the issue? Volatile Dekker’s algorithm Publication and Escape Thread Confinement Immutability.
Software Verification Bertrand Meyer Chair of Software Engineering Lecture 2: Axiomatic semantics.
Hashing General idea: Get a large array
Describing Syntax and Semantics
Linear Systems The definition of a linear equation given in Chapter 1 can be extended to more variables; any equation of the form for real numbers.
Sequential Circuits Chapter 4 S. Dandamudi To be used with S. Dandamudi, “Fundamentals of Computer Organization and Design,” Springer,  S.
Verifying a Wait Free Register Algorithm Using Assertional Reasoning Xu Qiwen Faculty of Science and Technology University of Macau.
Maria-Cristina Marinescu Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology A Synthesis Algorithm for Modular Design of.
Pre/Post Condition Logic 03/06/2013. Agenda Hoare’s Logic Overview Application to Pre/Post Conditions.
ME451 Kinematics and Dynamics of Machine Systems Review of Linear Algebra 2.1 through 2.4 Th, Sept. 08 © Dan Negrut, 2011 ME451, UW-Madison TexPoint fonts.
SOFTWARE ENGINEERING BIT-8 APRIL, 16,2008 Introduction to UML.
Reading and Writing Mathematical Proofs
Benjamin Gamble. What is Time?  Can mean many different things to a computer Dynamic Equation Variable System State 2.
1 Inference Rules and Proofs (Z); Program Specification and Verification Inference Rules and Proofs (Z); Program Specification and Verification.
CSI 3125, Axiomatic Semantics, page 1 Axiomatic semantics The assignment statement Statement composition The "if-then-else" statement The "while" statement.
ME451 Kinematics and Dynamics of Machine Systems Review of Linear Algebra 2.1 through 2.4 Tu, Sept. 07 © Dan Negrut, 2009 ME451, UW-Madison TexPoint fonts.
CS6133 Software Specification and Verification
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Mutual Exclusion.
A Universe-Type-Based Verification Technique for Mutable Static Fields and Methods Alexander J Summers Sophia Drossopoulou Imperial College London Peter.
Program Analysis and Verification Spring 2014 Program Analysis and Verification Lecture 4: Axiomatic Semantics I Roman Manevich Ben-Gurion University.
ISBN Chapter 3 Describing Semantics.
COP4020 Programming Languages Introduction to Axiomatic Semantics Prof. Robert van Engelen.
Program correctness The State-transition model A global states S  s 0 x s 1 x … x s m {s k = set of local states of process k} S0  S1  S2  Each state.
Lecture 5 1 CSP tools for verification of Sec Prot Overview of the lecture The Casper interface Refinement checking and FDR Model checking Theorem proving.
CSCI1600: Embedded and Real Time Software Lecture 11: Modeling IV: Concurrency Steven Reiss, Fall 2015.
Principle of Programming Lanugages 3: Compilation of statements Statements in C Assertion Hoare logic Department of Information Science and Engineering.
Ordering of Events in Distributed Systems UNIVERSITY of WISCONSIN-MADISON Computer Sciences Department CS 739 Distributed Systems Andrea C. Arpaci-Dusseau.
From Natural Language to LTL: Difficulties Capturing Natural Language Specification in Formal Languages for Automatic Analysis Elsa L Gunter NJIT.
Presented by: Belgi Amir Seminar in Distributed Algorithms Designing correct concurrent algorithms Spring 2013.
Agenda  Quick Review  Finish Introduction  Java Threads.
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
The Relationship Between Separation Logic and Implicit Dynamic Frames
Matching Logic An Alternative to Hoare/Floyd Logic
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Lecture 5 Floyd-Hoare Style Verification
Axiomatic semantics Points to discuss: The assignment statement
Threading And Parallel Programming Constructs
CSE 370 – Winter Sequential Logic-2 - 1
Concurrency: Mutual Exclusion and Process Synchronization
Program correctness Axiomatic semantics
COP4020 Programming Languages
Presentation transcript:

Aquinas Hobor and Cristian Gherghina (National University of Singapore) TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A A

Barriers Barriers: Mechanism for synchronizing multiple parties at specific synchronization points 2 ABC time

Barriers Why barriers? We looked at PARSEC Leading benchmark for shared memory systems Provides representative sample of parallel programs workloads Out of 13 PARSEC applications 5 (38%) use barriers Fields like: financial analysis, computer vision, engineering, animation, data mining 3

Barriers Why barriers? not easy to reduce to other synchronization mechanisms like locks or channels have an interesting property : They are a multiparty stateful synchronization mechanism 4

Barriers in Concurrent Separation Logic(CSL) Aims: Extend CSL with rules for modularly reasoning about barriers Define the necessary side conditions Proof the soundness of the barrier rules (mechanically verify the proof in Coq) 5

Overview Example of barrier use: Video compression algorithm Notation description Key observations, translation to side conditions Hoare Rules and side conditions Comments about the soundness proof 6

Example of Barrier Usage Parallel video encoding: Divide the frame into n parts, one per thread Each frame depends on the previous More so, each part of a frame does depend on the entire previous frame (e.g.. Moving objects) Sounds like a good place for a barrier! 7

Ridiculously simplified… We have two threads, and four shared data memory cells, divided into pairs (x 1, x 2 ) and (y 1, y 2 ) Each thread computes one cell of the “current” pair using both cells from the “previous” pair They synchronize with barrier b Memory cell i, the frame count is also shared 8

9 Synchronize Write new frame Y Read old frame X Synchronize Read frame Y Write new X Counter ++ Code example

10 Code example State 0 State 2 State 3 State 1 State 0 State 1 State 2 State 3

11 Barrier state machine State 0 0 State 1 1 State 2 2 State

Observations Barrier use is inherently statefull For each thread, each state is characterized by reads from specific cells and writes to specific cells From state to state and from thread to thread these permission requirements change The transitions do not always mirror the control flow graph State changes and permission reshuffling are tightly linked to the barrier calls 12

Prerequisites ( extensions to Separation Logic) “maps-to” assertions : e 1  e 2 mean the current thread owns the memory location pointed to by e 1 with ¼ permission and that location currently contains e 2. π can be either: Full, ¥ (reading and writing allowed) Empty, ¤ (nothing allowed) Or partial, i.e., ¤ < ¼ < ¥ (read only) the symbols and indicate two distinct partial shares With: © = ¥ 13 ¼

x 1 i Explaining a notation 14 PRECONDITIONS POSTCONDITIONS

barrier (b, ¼, n) The “is-a-barrier” assertion: Means the current thread owns the (nonempty) share ¼ of the barrier b, currently in state n 15 Prerequisites ( extensions to Separation Logic)

x 1 i b-state Explaining a notation 16

Barriers in CSL Problem: Encoding the reshuffling of permissions and the staging associated with barrier calls Solution: State diagram with labeled transitions Labels consist of pairs of pre/post conditions 17

18

Key Restrictions on Barrier Definitions 1. A barrier reshuffles It does not create resources Translated: For a given transition, the total preconditions and postconditions must be equal modulo the barrier state change 19 x 1 i b-state

Key Restrictions on Barrier Definitions 1. Threads always agree on the barrier state Directions must be mutually exclusive: one thread cannot go left while the other goes right 20

Hoare Rules There are other technical restrictions on barrier definitions but they are less interesting Instead, we will present our Hoare rules Actually, almost all of our rules are standard Skip, If, Sequence, While, Assign, Consequence, Frame, Store, Load, New, Free 21

Barrier Rule Lookup_move finds a pre/postcondition in the barrier state diagram Actually, this rule is so simple that it seems false: cs, ns, and ln seem free in the premises! 22 nsln

Barrier Rule This is not true: cs and ns are uniquely determined (the barrier is in some state, and recall mutual exclusion) ln is not determined, but if more than one is possible, then the barrier will never end! 23 nsln

24

25

The barrier call from line bn {Q} Γ(bn) = b

27

The barrier call from line 13 28

29

The barrier call from line 13 30

31 P Q

The barrier call from line 13 32

Soundness Given: a concurrent machine An operational semantics defined for that machine A Hoare rule is sound if: Whenever a Hoare triple {P}c{Q} holds and Q is enough to ensure safety after c then all states satisfying P are safe A state is safe if in none of the successor states, the machine blocks 33

Coq development 34 3,352 16,598

Take away Common barrier usage makes them an implicitly statefull multiparty synchronization mechanism We have introduced an amazingly simple Hoare rule for dealing with barrier calls We have proven sound the Hoare rules 35