CIS 720 Lecture 4.

Slides:



Advertisements
Similar presentations
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 12.
Advertisements

If R = {(x,y)| y = 3x + 2}, then R -1 = (1) x = 3y + 2 (2) y = (x – 2)/3 (3) {(x,y)| y = 3x + 2} (4) {(x,y)| y = (x – 2)/3} (5) {(x,y)| y – 2 = 3x} (6)
Inclusion-Exclusion Rosen 6.5 & 6.6
Impossibilities for Disjoint-Access Parallel Transactional Memory : Alessia Milani [Guerraoui & Kapalka, SPAA 08] [Attiya, Hillel & Milani, SPAA 09]
Lecture & 6.6 Inclusion-Exclusion. 6.5 Inclusion-Exclusion A AB U It’s simply a matter of not over-counting the blue area in the intersection.
50.530: Software Engineering Sun Jun SUTD. Week 13: Rely-Guarantee Reasoning.
Virtual Time “Virtual Time and Global States of Distributed Systems” Friedmann Mattern, 1989 The Model: An asynchronous distributed system = a set of processes.
CIS 720 Lecture 2. Concurrency …shared variable declaration…. …shared variable initialization… co P 1 // P 2 // P 3 // P 4 oc Execution of P 1 … P 4 starts.
Reduction, abstraction, and atomicity: How much can we prove about concurrent programs using them? Serdar Tasiran Koç University Istanbul, Turkey Tayfun.
Hoare’s Correctness Triplets Dijkstra’s Predicate Transformers
© Katz, Spring 2004 CS Formal SpecificationsLecture-- Lamport 1 Lamport ’s State Machines Formal Specifications of Complex Systems CS Spring.
VIDE Integrated Environment for Development and Verification of Programs.
TR1413: INTRO TO DISCRETE MATHEMATICS LECTURE 2: MATHEMATICAL INDUCTION.
What is the best way to start? 1.Plug in n = 1. 2.Factor 6n 2 + 5n Let n be an integer. 4.Let n be an odd integer. 5.Let 6n 2 + 5n + 4 be an odd.
DAST 2005 Tirgul 6 Heaps Induction. DAST 2005 Heaps A binary heap is a nearly complete binary tree stored in an array object In a max heap, the value.
Verifying a Wait Free Register Algorithm Using Assertional Reasoning Xu Qiwen Faculty of Science and Technology University of Macau.
CIS 720 Concurrency Control. Locking Atomic statement –Can be used to perform two or more updates atomically Th1: …. ;……. Th2:…………. ;…….
1 Programming Languages (CS 550) Lecture 9 Summary Introduction to Formal Semantics Jeremy R. Johnson TexPoint fonts used in EMF. Read the TexPoint manual.
COMP 170 L2 Page 1 Review for Midterm 1 l Part I: Counting n L01-L03 l Part II: Number Theory and Cryptography n L04, L05.
Program Correctness. 2 Program Verification An object is a finite state machine: –Its attribute values are its state. –Its methods optionally: Transition.
Induction Proof. Well-ordering A set S is well ordered if every subset has a least element. [0, 1] is not well ordered since (0,1] has no least element.
Separation and Information Hiding Peter W. O’Hearn (Queen Mary, University of London) John C. Reynolds (Carnegie Mellon University) Hongseok Yang (Seoul.
CIS 720 Correctness of Concurrent Programs. i := 1 max := A[1] do i < n  i = i + 1 if (max < A[i]) max = A[i] od.
From … to Induction CS 270 Math Foundations of CS Jeremy Johnson.
CIS 720 Lecture 5. Techniques to avoid interference Disjoint variables –If the write set of each process is disjoint from the read and write set of other.
Program Analysis and Verification
1 Computer Algorithms Tutorial 2 Mathematical Induction Some of these slides are courtesy of D. Plaisted et al, UNC and M. Nicolescu, UNR.
Chapter 5 With Question/Answer Animations 1. Chapter Summary Mathematical Induction - Sec 5.1 Strong Induction and Well-Ordering - Sec 5.2 Lecture 18.
NIRICT RECONNAISSANCE TOPIC PERFORMANCE AND CORRECTNESS OF GPGPU MARIEKE HUISMAN ALEXANDRU IOSUP ANA LUCIA VARBANESCU ANTON WIJS.
Greedy Algorithms General principle of greedy algorithm
Greedy algorithms: CSC317
Algorithmics - Lecture 11
CSE 311: Foundations of Computing
What I Teach (Do what I say, not what I do)
Self-stabilization.
Mathematical Structures for Computer Science Chapter 1
Atomicity, Non-determinism, Fairness
CIS 720 Concurrency Control.
CS 3343: Analysis of Algorithms
Notes 9.5 – Mathematical Induction
CIS 720 Mutual Exclusion 2.
Vertical Fragmentation
Outline Introduction Background Distributed DBMS Architecture
CIS 720 Message Passing.
Invariant Based Methodology
CS21 Decidability and Tractability
Axiomatic Verification II
CIS 720 Message Passing.
Linear Time Properties
Energy-Efficient Target Coverage in Wireless Sensor Networks
Chapter 11: Further Topics in Algebra
CIS 720 Lecture 5.
Program correctness Axiomatic semantics
15. Legendre Functions Legendre Polynomials Orthogonality
CIS 720 Message Passing.
CIS 720 Lecture 6.
15. Legendre Functions Legendre Polynomials Orthogonality
CIS 720 Lecture 4.
CIS 720 Lecture 4.
CIS 720 Lecture 3.
CIS 720 Lecture 3.
' · · ,.-.., '' !'",. -,..._ ·-.·-...;.· -
CIS 720 Lecture 5.
CIS 720 Lecture 2.
CIS 720 Lecture 4.
CIS825 Lecture 5 1.
CIS 720 Lecture 4.
CIS 720 Lecture 2.
CIS 720 Mutual Exclusion 2.
Program Analysis and Verification
Presentation transcript:

CIS 720 Lecture 4

i := 1 max := A[1] do i < n  i = i + 1 if (max < A[i]) max = A[i] od

Concurrency rule for all i, { Pi } Si { Qi } { P1 /\ …. /\ Pn } co S1 // …. // Sn { Q1 /\ …. /\ Qn}

x = 0; y = 1; x = 0; co co x = 1 x = x + 1 // // y = y + 1 x = x + 2 oc oc

Interference freedom Let a be a statement and C be an assertion. NI(a, C) iff { pre(a) /\ C } a { C } Execution of a does not invalidates (or interferes) with C.

{ Pi } Si { Qi }, for all I, are interference free if for all assertions C in proof outline of Si, for all actions a in Sj, i != j NI(a, C) holds

Concurrency rule { Pi } Si { Qi } are interference free { P1 /\ …. /\ Pn } co S1 // …. // Sn { Q1 /\ …. /\ Qn}

x= 0; co x = x + 1 // x = x + 2 od

Bank transactions co // Transfer(x,y,am): Auditor: ac[x] = ac[x] – am; total = 0; i = 0; ac[y] = ac[y] + am do i < n total = total + ac[i] i = i + 1 od oc

Bank transactions co // Transfer(x,y,am): Auditor: if < !auditon  ac[x] = ac[x] – am; auditon = 1; total = 0; i = 0; ac[y] = ac[y] + am > [] do i < n <auditon && ( (x < i && y < i) ||(x > I && y > i)) total = total + ac[i]  ac[x] = ac[x] – am; ac[y] = ac[y] + am> i = i + 1 fi od auditon = 0 oc

Techniques to avoid interference Disjoint variables If the write set of each process is disjoint from the read and write set of other processes, then the proof outlines will be interference free.

Avoiding interference Weakened assertions x= 0; co x = x + 1 // x = x + 2 od

Avoiding interference Global Invariants: Assume that every assertion in the proof outline of Pi is of the form I /\ L, where L refers to local variables of Pi or to variables that only Pi writes. - Then the proof outlines will be interference free.

Concurrency rule for all i, { I} Si { I } { I } co S1 // …. // Sn { I}

Avoiding interference Synchronization