Synthesis for Concurrency

Size: px
Start display at page:

Download "Synthesis for Concurrency"

Transcription

1 Synthesis for Concurrency Martin Vechev ETH Zurich (joint work with Eran Yahav, Greta Yorsh) 1

2 Concurrency is Everywhere

3 Unreliable Concurrency is Everywhere

4 2003 Northeast Blackout concurrency error triggers massive power outage economic effect : ~ 6 billion $USD

5 Unreliable Concurrency: Data Structures val popright() { while (true) { rh = RightHat; lh = LeftHat; if (rh->r == rh) return "empty"; if (rh == lh) { if (DCAS(&RightHat, &LeftHat, rh, lh, Dummy, Dummy)) return rh->v; else { rhl = rh->l; if (DCAS(&RightHat, &rh->l, rh, rhl, rhl, rh)) { result = rh->v; rh->r = Dummy; return result; Even better DCAS-based concurrent deques, DISC 2000

6 Unreliable Concurrency: Data Structures val popright() { while (true) { rh = RightHat; lh = LeftHat; if (rh->r == rh) return "empty"; if (rh == lh) { Bad News: if (DCAS(&RightHat, &LeftHat, rh, lh, Dummy, Dummy)) return rh->v; else { 2 rhl errors = rh->l; in < 20 lines of code if (DCAS(&RightHat, &rh->l, rh, rhl, rhl, rh)) { result = rh->v; rh->r = Dummy; return result; Even better DCAS-based concurrent deques, DISC 2000

7 Unreliable Concurrency: Weak Memory Models int take() long b = bot-1; item_t *q = wsq; bot = b long t = top if (b < t) { bot = t; return EMPTY; task = q->ap[b%q->sz]; if (b > t) return task if (!CAS(&top,t,t+1)) return EMPTY; bot = t + 1; return task; void push(int task) long b = bot; long t = top; item_t *q = wsq; if (b t q->sz 1){ wsq = expand(); q = wsq; q->ap[b%q->sz]=task; bot = b+1; int steal() long t = top; long b = bot; item_t *q = wsq; if (t b) return EMPTY; task=q->ap[t%q->sz]; if (!CAS(&top,t,t+1)) return ABORT; return task; 7

8 Unreliable Concurrency: Weak Memory Models int take() long b = bot-1; item_t *q = wsq; bot = b long t = top if (b < t) { bot = t; return EMPTY; task = q->ap[b%q->sz]; if (b > t) return task if (!CAS(&top,t,t+1)) return EMPTY; bot = t + 1; return task; void push(int task) long b = bot; long t = top; item_t *q = wsq; if (b t q->sz 1){ wsq = expand(); q = wsq; q->ap[b%q->sz]=task; bot = b+1; int steal() long t = top; long b = bot; item_t *q = wsq; if (t b) return EMPTY; task=q->ap[t%q->sz]; if (!CAS(&top,t,t+1)) return ABORT; return task; 8

9 9 Concurrent Set Algorithm bool add(int key) { Entry *pred,*curr,*entry restart: locate(pred,curr,key) k = (curr->key == key) if (k) return false entry = new Entry() entry->next = curr val=cas(&pred->next, curr,0, entry,0 ) if ( val) goto restart bool remove(int key) { Entry *pred,*curr,*r restart: locate(pred,curr,key) k = (curr->key key) if (k) return false <r,m> = curr->next lval=cas(&curr->next, r,m, r,1 ) if ( lval) goto restart pval=cas(&pred->next, curr,0, r,0 ) if ( pval) goto restart bool contains(int key) { Entry *pred,*curr locate(pred,curr,key) k = (curr->key == key) if (k) return false

10 10 Concurrent Set Algorithm bool add(int key) { Entry *pred,*curr,*entry restart: The locate(pred,curr,key) Good k = (curr->key == key) if New (k) algorithm return false bool remove(int key) { Entry *pred,*curr,*r restart: locate(pred,curr,key) k = (curr->key key) if (k) return false entry Fine-grained = new Entry() synchronization (CAS) <r,m> = curr->next entry->next = curr val=cas(&pred->next, curr,0, entry,0 ) if ( val) goto restart lval=cas(&curr->next, r,m, r,1 ) if ( lval) goto restart pval=cas(&pred->next, curr,0, r,0 ) if ( pval) goto restart bool contains(int key) { Entry *pred,*curr locate(pred,curr,key) k = (curr->key == key) if (k) return false

11 11 Concurrent Set Algorithm bool add(int key) { Entry *pred,*curr,*entry restart: The locate(pred,curr,key) Good k = (curr->key == key) if New (k) algorithm return false entry Fine-grained = new Entry() synchronization (CAS) <r,m> = curr->next entry->next = curr val=cas(&pred->next, curr,0, entry,0 ) The if ( val) Bad goto restart Can you understand what it does? Can you show it is correct? bool contains(int key) { Entry *pred,*curr locate(pred,curr,key) k = (curr->key == key) if (k) return false bool remove(int key) { Entry *pred,*curr,*r restart: locate(pred,curr,key) k = (curr->key key) if (k) return false lval=cas(&curr->next, r,m, r,1 ) if ( lval) goto restart pval=cas(&pred->next, curr,0, r,0 ) if ( pval) goto restart

12 12 Concurrent Set Algorithm bool add(int key) { Entry *pred,*curr,*entry restart: The locate(pred,curr,key) Good k = (curr->key == key) if New (k) algorithm return false entry Fine-grained = new Entry() synchronization (CAS) <r,m> = curr->next entry->next = curr val=cas(&pred->next, curr,0, entry,0 ) The if ( val) Bad goto restart Can you understand what it does? Can you show it is correct? The Ugly How did you get it? Anything repeatable? Any other similar algorithms? bool contains(int key) { Entry *pred,*curr locate(pred,curr,key) k = (curr->key == key) if (k) return false bool remove(int key) { Entry *pred,*curr,*r restart: locate(pred,curr,key) k = (curr->key key) if (k) return false lval=cas(&curr->next, r,m, r,1 ) if ( lval) goto restart pval=cas(&pred->next, curr,0, r,0 ) if ( pval) goto restart

13 13 Sequential Set Algorithm bool add(int key){ atomic Entry *pred,*curr,*entry locate(pred,curr,key); k = (curr->key == key) if (k) return false entry = new Entry() entry->next = curr pred->next = entry bool remove(int key){ atomic Entry *pred,*curr,*r locate(pred,curr,key) k = (curr->key key) if (k) return false r = curr->next pred->next = r bool contains(int key) { atomic Entry *pred,*curr locate(pred,curr,key) k = (curr->key == key) if (k) return false

14 14 Sequential Set Algorithm bool add(int key){ atomic Entry *pred,*curr,*entry locate(pred,curr,key); k = (curr->key == key) if (k) return false entry = new Entry() entry->next = curr pred->next = entry Understandable Proving correctness easier bool remove(int key){ atomic Entry *pred,*curr,*r locate(pred,curr,key) k = (curr->key key) if (k) return false r = curr->next pred->next = r bool contains(int key) { atomic Entry *pred,*curr locate(pred,curr,key) k = (curr->key == key) if (k) return false

15 15 Sequential to Highly Concurrent bool add(int key){ atomic Entry *pred,*curr,*entry locate(pred,curr,key); k = (curr->key == key) if (k) return false entry = new Entry() entry->next = curr pred->next = entry bool remove(int key){ atomic Entry *pred,*curr,*r locate(pred,curr,key) k = (curr->key key) if (k) return false r = curr->next pred->next = r

16 16 Sequential to Highly Concurrent bool add(int key){ atomic Entry *pred,*curr,*entry locate(pred,curr,key); k = (curr->key == key) if (k) return false entry = new Entry() entry->next = curr pred->next = entry bool add(int key) { Entry *pred,*curr,*entry restart: locate(pred,curr,key) k = (curr->key == key) if (k) return false entry = new Entry() entry->next = curr val=cas(&pred->next, curr,0, entry,0 ) if ( val) goto restart bool remove(int key){ atomic Entry *pred,*curr,*r locate(pred,curr,key) k = (curr->key key) if (k) return false r = curr->next pred->next = r bool remove(int key) { Entry *pred,*curr,*r restart: locate(pred,curr,key) k = (curr->key key) if (k) return false <r,m> = curr->next lval=cas(&curr->next, r,m, r,1 ) if ( lval) goto restart pval=cas(&pred->next, curr,0, r,0 ) if ( pval) goto restart

17 17 Sequential to Highly Concurrent bool add(int key){ atomic Entry *pred,*curr,*entry locate(pred,curr,key); k = (curr->key == key) if (k) return false entry = new Entry() entry->next = curr pred->next = entry??? bool add(int key) { Entry *pred,*curr,*entry restart: locate(pred,curr,key) k = (curr->key == key) if (k) return false entry = new Entry() entry->next = curr val=cas(&pred->next, curr,0, entry,0 ) if ( val) goto restart bool remove(int key){ atomic Entry *pred,*curr,*r locate(pred,curr,key) k = (curr->key key) if (k) return false r = curr->next pred->next = r bool remove(int key) { Entry *pred,*curr,*r restart: locate(pred,curr,key) k = (curr->key key) if (k) return false <r,m> = curr->next lval=cas(&curr->next, r,m, r,1 ) if ( lval) goto restart pval=cas(&pred->next, curr,0, r,0 ) if ( pval) goto restart

18 18 Bridging the Gap Find small repeatable transformations NO magic insights Combination of manual and automatic transformations

19 Transformations Removing redundant atomicity s1 s2 s3 s4 s1 s2 s3 s4 Reordering statements s1 s2 s3 s4 s2 s1 s3 s4 Optimistic concurrency read update read If (validate) update else restart Add synchronization meta-data s1 s2 s3 s4 s1 If (t > 0) s2 s3 s4

20 Transformations Machine Removing redundant atomicity s1 s2 s3 s4 s1 s2 s3 s4 Machine Reordering statements s1 s2 s3 s4 s2 s1 s3 s4 Machine + Human Optimistic concurrency read update read If (validate) update else restart Only Human Add synchronization meta-data s1 s2 s3 s4 s1 If (t > 0) s2 s3 s4

21 Synthesis Process Machine verifier program yes/counterexample synthesizer Exploration Validation Checked Algorithms Schema Human

22 Program Synthesis verifier Machine program yes/counterexample synthesizer 15

23 Program Synthesis verifier Machine program yes/counterexample synthesizer analyze program 15

24 Program Synthesis verifier Machine program yes/counterexample synthesizer analyze program 15

25 Program Synthesis verifier Machine program yes/counterexample synthesizer analyze program 15

26 Program Synthesis verifier Machine program yes/counterexample synthesizer analyze program 15

27 Program Synthesis verifier Machine program yes/counterexample synthesizer propagate correctness 15

28 Program Synthesis verifier Machine program yes/counterexample synthesizer analyze program 15

29 Program Synthesis verifier Machine program yes/counterexample synthesizer propagate incorrectness 15

30 Sequential To Concurrent Sequential Schema Correct Algorithm Existing Algorithm New Algorithm Priority Queue Stack DCAS DCAS CAS CAS with LOCKS Michael (PODC 02) Heller et al. (OPODIS 05) CAS/DCAS Trieber Stack 30

31 31 step 1: Optimistic Concurrency [Kung & Robinson 81] bool remove(int key){ Entry *pred,*curr,*r atomic locate(pred,curr,key) k = (curr->key key) if (k) return false r = curr->next pred->next = r Read Update bool remove(int key){ Entry *pred,*curr,*r restart: Read atomic if (validate) { Update goto restart

32 step 1: Optimistic Concurrency [Kung & Robinson 81] bool remove(int key){ Entry *pred,*curr,*r atomic locate(pred,curr,key) k = (curr->key key) if (k) return false r = curr->next pred->next = r Read Update bool remove(int key){ Entry *pred,*curr,*r restart: locate(pred,curr,key) atomic if (validate) { k = (curr->key key) if (k) return false r = curr->next pred->next = r goto restart

33 33 step 2: Run Tool bool remove(int key){ Entry *pred,*curr,*r restart: locate(pred,curr,key) atomic if (validate) { k = (curr->key key) if (k) return false r = curr->next pred->next = r goto restart ( (pred curr) (->next)? == (pred curr) (->next)? ) true Synthesizer looks for expressions to fill the validate hole Insufficient information to write a validation condition No correct completion found

34 34 step 2: Examine Counterexample Thread 1: Thread 2: add(4) remove(1) head tail head tail head tail pred curr pred curr add(4) starts remove(1) executes add(4) ends Addition of key 4 is lost How to deal with removed nodes?

35 But What Now? Space Synchronization Time

36 36 step 3: Synchronization Metadata OBJECT OBJECT key next key next marked REMOVE = { R1: k = (curr->key key) R2: if (k) return false R3: curr->marked = true R4: mp = pred->marked R5: mc = curr->marked R6: val= (pred->next == curr) ( mp)? ( mc)? R7: if ( val) goto restart R8: r = curr->next R9: pred->next = r

37 37 step 4: Run Synthesis bool remove(int key) { Entry *pred,*curr,*r restart: locate(pred,curr,key) REMOVE REMOVE = { R1: k = (curr->key key) R2: if (k) return false R3: curr->marked = true R4: mp = pred->marked R5: mc = curr->marked R6: val= (pred->next == curr)? ( mp)? ( mc) R7: if ( val) goto restart R8: r = curr->next R9: pred->next = r Synthesis bool remove(int key) { Entry *pred,*curr,*r restart: locate(pred,curr,key) REMOVE REMOVE = { k = (curr->key key) if (k) return false curr->marked = true r = curr->next atomic mp = pred->marked val=(pred->next==curr) mp if ( val) goto restart pred->next = r

38 38 Result (pldi 08) bool add(int key) { Entry *pred,*curr,*entry restart: locate(pred,curr,key) k = (curr->key == key) if (k) return false entry = new Entry() entry->next = curr val=cas(&pred->next, curr,0, entry,0 ) if ( val) goto restart bool remove(int key) { Entry *pred,*curr,*r restart: locate(pred,curr,key) k = (curr->key key) if (k) return false <r,m> = curr->next lval=cas(&curr->next, r,m, r,1 ) if ( lval) goto restart pval=cas(&pred->next, curr,0, r,0 ) if ( pval) goto restart bool contains(int key) { Entry *pred,*curr locate(pred,curr,key) k = (curr->key == key) if (k) return false

39 39 Concurrent Set Algorithms Recap Sequential Schema Correct Algorithm Existing Algorithm New Algorithm DCAS DCAS CAS CAS with LOCKS CAS/DCAS Priority Queue Stack Michael (PODC 02) Heller et al. (OPODIS 05) Trieber Stack

40 Synthesis Process Machine verifier program yes/counterexample synthesizer Exploration Validation Checked Algorithms Schema Human

41 Key questions Are schemas a natural input for a designer? can be difficult for designers, prefer programs Why are search and verification separate? Verifier overwhelmed with many incorrect or similar programs Can synchronization inference be automated? atomicity, ordering, space (big challenge) 27

42 Another approach: verification-driven The input to synthesizer is a program synthesizer repairs or fixes an incorrect program Verifier does synthesis can output a program, not just yes/no Automates synchronization inference some synchronization (but not all, e.g. space is not) 28

43 Synthesis Process Synthesizer produces various repairs versions of the program verifier extended to do synthesis Synthesizer repairs the program by synthesizing synchronization Checked Algorithms Program Human

44 Challenge Find minimal synchronization that makes the program satisfy the specification Avoid all bad schedules while permitting as many good schedules as possible Assumption: we can prove that serial executions satisfy the specification Interested in bad behaviors due to concurrency Handle infinite-state programs 30

45 Abstraction-Guided Synthesis of Synchronization Synthesis of synchronization via abstract interpretation Compute over-approximation of all possible program executions Add minimal synchronization to avoid (over-approximation of) bad schedules Interplay between abstraction and synchronization Finer abstraction may enable finer synchronization Coarse synchronization may allow coarser abstraction 31

46 A Standard Approach: Abstraction Refinement Program P Valid Specification S Verify Abstract counter example Abstraction Abstraction Refinement Abstract counter example Change the abstraction to match the program 32

47 Abstraction-Guided Synthesis [VYY-POPL 10] Program P ϕ Program Restriction Implement P Specification S Verify Abstract counter example Abstraction Abstraction Refinement Abstract counter example Change the program to match the abstraction 33

48 AGS Algorithm High Level Input: Program P, Specification S, Abstraction Output: Program P satisfying S under ϕ = true while(true) { BadTraces = {π π ( P ϕ ) and π S if (BadTraces is empty) return implement(p,ϕ) select π BadTraces if (?) { ψ = avoid(π) if (ψ false) ϕ = ϕ ψ else abort else { = refine(, π) if ( ) = else abort 34

49 Avoid and Implement Desired output program satisfying the spec Constraint has to be implementable in the program Implementation mechanism guides the choice of constraint language Implementation mechanisms Atomic sections [POPL 10] Conditional critical regions (CCRs) [TACAS 09] Memory fences (for relaxed memory models) [FMCAD 10 + PLDI 11] Barriers [SAS 13] 35

50 Avoiding a schedule with atomic sections Adding atomicity constraints Atomicity predicate [l 1,l 2 ] statements at l 1 and l 2 must execute together atomically avoid(π) A disjunction of all possible atomicity predicates that would prevent π Captures all ways to avoid π using atomic sections avoid(π) = { [label(π i ),label(π j )] 0 i < π, j > i + 1. tid(π i ) = tid(π j ) s.t. k.i < k < j, tid(π i ) tid(π k ) 36

51 Avoid with atomicity constraints A1 1,1 B1 Thread A 1: A1 2: A2 Thread B 1: B1 2: B2 2,1 1,2 A2 B1 A1 B2 3,1 B1 A2 2,2 B2 A1 1,3 π = A 1 B 1 A 2 B 2 avoid(π) = [A 1,A 2 ] [B 1,B 2 ] 3,2 2,3 B2 A2 3,3 37

52 Avoiding the good with the bad ψ = avoid(π) Enforcing ψ avoids any abstract trace π such that π ψ Potentially avoiding good traces as well A1 B1 A2 A3 A1 B1 A2 A3 avoid( 1) = [A1,A2] 38

53 Simple Example T1 1: x += z 2: x += z T2 1: z++ 2: z++ T3 1: y1 = f(x) 2: y2 = x 3: assert(y1!= y2) atomic f(x) { if (x == 1) return 3 else if (x == 2) return 6 else return 5 Initially x = z = 0 Every single statement is atomic 39

54 Example: Concrete Values y Concrete values y2 x += z; x += z; z++;z++;y1=f(x);y2=x;assert y1=5,y2=0 z++; x+=z; y1=f(x); z++; x+=z; y2=x;assert y1=3,y2=3 T1 1: x += z 2: x += z T2 1: z++ 2: z++ T3 1: y1 = f(x) 2: y2 = x 3: assert(y1!= y2) f(x) { if (x == 1) return 3 else if (x == 2) return 6 else return 5 40

55 Example: Parity Abstraction y Concrete values y2 y y2 Parity abstraction (even/odd) x += z; x += z; z++;z++;y1=f(x);y2=x;assert y1=odd,y2=even T1 1: x += z 2: x += z T2 1: z++ 2: z++ T3 1: y1 = f(x) 2: y2 = x 3: assert(y1!= y2) f(x) { if (x == 1) return 3 else if (x == 2) return 6 else return 5 41

56 Example: Avoiding Bad Interleavings ϕ = true while(true) { z++ BadTraces={π π ( P ϕ ) and π S if (BadTraces is empty) return implement(p,ϕ) T1 x+=z x+=z select π BadTraces if (?) { ϕ = ϕ avoid(π) else { = refine(, π) z++ avoid(π 1 ) = [z++,z++] ϕ = [z++,z++] true Showing only states leading to bad states T3 y1=f(x) y2=x 42

57 Example: Avoiding Bad Interleavings ϕ = true while(true) { BadTraces={π π ( P ϕ ) and x+=z π S if (BadTraces is empty) return implement(p,ϕ) select π BadTraces if (?) { x+=z ϕ = ϕ avoid(π) else { = refine(, π) avoid(π 2 ) =[x+=z,x+=z] T3 y1=f(x) y2=x ϕ = [z++,z++] ϕ = [z++,z++] [x+=z,x+=z] 43

58 Example: Avoiding Bad Interleavings ϕ = true while(true) { BadTraces={π π ( P ϕ ) and π S if (BadTraces is empty) return implement(p,ϕ) select π BadTraces if (?) { ϕ = ϕ avoid(π) else { = refine(, π) T1 1: x += z 2: x += z T2 1: z++ 2: z++ T3 1: y1 = f(x) 2: y2 = x 3: assert(y1!= y2) ϕ = [z++,z++] [x+=z,x+=z] 44

59 Example: Avoiding Bad Interleavings parity T1 T2 T3 x+=z; x+=z z++; z++; y1=f(x) y2=x assert y1!= y2 y y2 parity T1 T2 T3 x+=z; x+=z z++; z++; y1=f(x) y2=x assert y1!= y parity T1 T2 T3 x+=z; x+=z z++; z++; y1=f(x) y2=x assert y1!= y But we can also change the abstraction 45

60 parity interval (d) octagon (f) T1 T2 x+=z; x+=z z++; z++; y parity T3 y1=f(x) T3 y1=f(x) T3 y2=x y2=x assert assert y1!= y2 y1!= y2 (a) y2 (b) (c) T1 T2 T3 T1 T2 T3 x+=z; x+=z z++; z++; y1=f(x) y2=x assert y1!= y2 x+=z; x+=z z++; z++; y1=f(x) y2=x assert y1!= y2 interval (e) octagon (g) T1 T2 T1 T2 T3 T1 T2 T3 x+=z; x+=z z++; z++; x+=z; x+=z z++; z++; y1=f(x) y2=x assert y1!= y2 x+=z; x+=z z++; z++; y1=f(x) y2=x assert y1!= y parity T1 T2 x+=z; x+=z z++; z++; y1=f(x) y2=x assert y1!= y

61 Multiple Solutions Interval abstraction for our example produces the atomicity constraint: ([x+=z,x+=z] [z++,z++]) ([y1=f(x),y2=x] [x+=z,x+=z] [z++,z++]) Performance: smallest atomic sections Minimal satisfying assignments 1 = [z++,z++] 2 = [x+=z,x+=z] 47

62 Implementability Separation between schedule constraints and how they are realized Can realize in program: atomic sections, locks, Can realize in scheduler: benevolent scheduler T1 1: while(*) { 2: x++ 3: x++ 4: T2 1: assert (x!= 1) No program transformations (e.g., loop unrolling) Memoryless strategy 48

63 Abstraction-Guided Synthesis Program P ϕ Program Restriction Implement P Specification S Verify Abstract counter example Abstraction Abstraction Refinement Abstract counter example 49

64 AGS instances Avoid Implementation Mechanism Abstraction Space (examples) Reference Context switch Atomic sections Numerical abstractions [POPL 10] Inter-thread ordering Synchronization barriers Numerical abstractions [SAS 13] Intra-thread ordering Memory fences Partial-Coherence abstractions for store buffers [FMCAD 10] [PLDI 11] [PLDI 12] Transition Conditional critical regions (CCRs) Observability [TACAS 09] 50

65 General Setting Revisited Program P ϕ Program Restriction Implement P specification S Verify Abstract counter example Spec Weakening S Abstraction Abstraction Refinement Σ Abstract counter example Change the specification to match the abstraction 51

66 Summary Synthesis of Concurrent Data Structures Search-based synthesis: schema + semantic search Discovered new algorithmic variants Synthesis of Synchronization Input is a program, synthesizer repairs programs Instances: atomics, barriers, memory fences, etc Future Challenges Synthesis of space is key Apply techniques in symbolic or dynamic execution Combining synchronization primitives 52

67 Thank You Questions? 53

ExCAPE. Expeditions in Computer Augmented Program Engineering

ExCAPE. Expeditions in Computer Augmented Program Engineering ExCAPE Expeditions in Computer Augmented Program Engineering Rajeev Alur, Ras Bodik, Jeff Foster, Bjorn Hartmann, Lydia Kavraki, Hadas Kress-Gazit, Stephane Lafortune, Boon Loo, P. Madhusudan, Milo Martin,

More information

Indistinguishability: Friend and Foe of Concurrent Data Structures. Hagit Attiya CS, Technion

Indistinguishability: Friend and Foe of Concurrent Data Structures. Hagit Attiya CS, Technion Indistinguishability: Friend and Foe of Concurrent Data Structures Hagit Attiya CS, Technion Uncertainty is a main obstacle for designing correct applications in concurrent systems Formally captured by

More information

Proving liveness. Alexey Gotsman IMDEA Software Institute

Proving liveness. Alexey Gotsman IMDEA Software Institute Proving liveness Alexey Gotsman IMDEA Software Institute Safety properties Ensure bad things don t happen: - the program will not commit a memory safety fault - it will not release a lock it does not hold

More information

No model may be available. Software Abstractions. Recap on Model Checking. Model Checking for SW Verif. More on the big picture. Abst -> MC -> Refine

No model may be available. Software Abstractions. Recap on Model Checking. Model Checking for SW Verif. More on the big picture. Abst -> MC -> Refine No model may be available Programmer Software Abstractions Tests Coverage Code Abhik Roychoudhury CS 5219 National University of Singapore Testing Debug Today s lecture Abstract model (Boolean pgm.) Desirable

More information

Lecture 21: Transactional Memory. Topics: consistency model recap, introduction to transactional memory

Lecture 21: Transactional Memory. Topics: consistency model recap, introduction to transactional memory Lecture 21: Transactional Memory Topics: consistency model recap, introduction to transactional memory 1 Example Programs Initially, A = B = 0 P1 P2 A = 1 B = 1 if (B == 0) if (A == 0) critical section

More information

Experience with Model Checking Linearizability

Experience with Model Checking Linearizability Experience with Model Checking Linearizability Martin Vechev, Eran Yahav, and Greta Yorsh IBM T.J. Watson Research Center Non-blocking concurrent algorithms offer significant performance advantages, but

More information

Predicate Abstraction for Relaxed Memory Models

Predicate Abstraction for Relaxed Memory Models Predicate Abstraction for Relaxed Memory Models Andrei Dan 1, Yuri Meshman 2, Martin Vechev 1, and Eran Yahav 2 1 ETH Zurich {andrei.dan, martin.vechev}@inf.ethz.ch 2 Technion {yurime, yahave}@cs.technion.ac.il

More information

Lecture: Consistency Models, TM. Topics: consistency models, TM intro (Section 5.6)

Lecture: Consistency Models, TM. Topics: consistency models, TM intro (Section 5.6) Lecture: Consistency Models, TM Topics: consistency models, TM intro (Section 5.6) 1 Coherence Vs. Consistency Recall that coherence guarantees (i) that a write will eventually be seen by other processors,

More information

Automatic Inference of Memory Fences

Automatic Inference of Memory Fences Automatic Inference of Memory Fences Michael Kuperstein, Martin Vechev, Eran Yahav Abstract We addresses the problem of automatic verification and fence inference in concurrent programs running under relaxed

More information

Parallel Computer Architecture Spring Memory Consistency. Nikos Bellas

Parallel Computer Architecture Spring Memory Consistency. Nikos Bellas Parallel Computer Architecture Spring 2018 Memory Consistency Nikos Bellas Computer and Communications Engineering Department University of Thessaly Parallel Computer Architecture 1 Coherence vs Consistency

More information

Software Model Checking. Xiangyu Zhang

Software Model Checking. Xiangyu Zhang Software Model Checking Xiangyu Zhang Symbolic Software Model Checking CS510 S o f t w a r e E n g i n e e r i n g Symbolic analysis explicitly explores individual paths, encodes and resolves path conditions

More information

Verifying Concurrent Programs

Verifying Concurrent Programs Verifying Concurrent Programs Daniel Kroening 8 May 1 June 01 Outline Shared-Variable Concurrency Predicate Abstraction for Concurrent Programs Boolean Programs with Bounded Replication Boolean Programs

More information

CONCURRENT LIBRARIES. Correctness Criteria, Verification

CONCURRENT LIBRARIES. Correctness Criteria, Verification CONCURRENT LIBRARIES Correctness Criteria, Verification Verification Ingredients Specifying a Library: φ Implementing a Library: L Verifying a Library implementation: L φ The History of an Object Object

More information

Linked Lists: The Role of Locking. Erez Petrank Technion

Linked Lists: The Role of Locking. Erez Petrank Technion Linked Lists: The Role of Locking Erez Petrank Technion Why Data Structures? Concurrent Data Structures are building blocks Used as libraries Construction principles apply broadly This Lecture Designing

More information

Even Better DCAS-Based Concurrent Deques

Even Better DCAS-Based Concurrent Deques Even Better DCAS-Based Concurrent Deques David L. Detlefs, Christine H. Flood, Alexander T. Garthwaite, Paul A. Martin, Nir N. Shavit, and Guy L. Steele Jr. Sun Microsystems Laboratories, 1 Network Drive,

More information

Inferring Synchronization under Limited Observability

Inferring Synchronization under Limited Observability Inferring Synchronization under Limited Observability Martin Vechev, Eran Yahav, and Greta Yorsh IBM T.J. Watson Research Center Abstract. This paper addresses the problem of automatically inferring synchronization

More information

Proving linearizability & lock-freedom

Proving linearizability & lock-freedom Proving linearizability & lock-freedom Viktor Vafeiadis MPI-SWS Michael & Scott non-blocking queue head tail X 1 3 2 null CAS compare & swap CAS (address, expectedvalue, newvalue) { atomic { if ( *address

More information

Lock-Free and Practical Doubly Linked List-Based Deques using Single-Word Compare-And-Swap

Lock-Free and Practical Doubly Linked List-Based Deques using Single-Word Compare-And-Swap Lock-Free and Practical Doubly Linked List-Based Deques using Single-Word Compare-And-Swap Håkan Sundell Philippas Tsigas OPODIS 2004: The 8th International Conference on Principles of Distributed Systems

More information

Lecture: Consistency Models, TM

Lecture: Consistency Models, TM Lecture: Consistency Models, TM Topics: consistency models, TM intro (Section 5.6) No class on Monday (please watch TM videos) Wednesday: TM wrap-up, interconnection networks 1 Coherence Vs. Consistency

More information

CS510 Advanced Topics in Concurrency. Jonathan Walpole

CS510 Advanced Topics in Concurrency. Jonathan Walpole CS510 Advanced Topics in Concurrency Jonathan Walpole Threads Cannot Be Implemented as a Library Reasoning About Programs What are the valid outcomes for this program? Is it valid for both r1 and r2 to

More information

Lecture 7: Transactional Memory Intro. Topics: introduction to transactional memory, lazy implementation

Lecture 7: Transactional Memory Intro. Topics: introduction to transactional memory, lazy implementation Lecture 7: Transactional Memory Intro Topics: introduction to transactional memory, lazy implementation 1 Transactions New paradigm to simplify programming instead of lock-unlock, use transaction begin-end

More information

Håkan Sundell University College of Borås Parallel Scalable Solutions AB

Håkan Sundell University College of Borås Parallel Scalable Solutions AB Brushing the Locks out of the Fur: A Lock-Free Work Stealing Library Based on Wool Håkan Sundell University College of Borås Parallel Scalable Solutions AB Philippas Tsigas Chalmers University of Technology

More information

Coherence and Consistency

Coherence and Consistency Coherence and Consistency 30 The Meaning of Programs An ISA is a programming language To be useful, programs written in it must have meaning or semantics Any sequence of instructions must have a meaning.

More information

Marwan Burelle. Parallel and Concurrent Programming

Marwan Burelle.   Parallel and Concurrent Programming marwan.burelle@lse.epita.fr http://wiki-prog.infoprepa.epita.fr Outline 1 2 Solutions Overview 1 Sharing Data First, always try to apply the following mantra: Don t share data! When non-scalar data are

More information

PROGRAM ANALYSIS & SYNTHESIS

PROGRAM ANALYSIS & SYNTHESIS Lecture 02 Structural Operational Semantics (SOS) PROGRAM ANALYSIS & SYNTHESIS EranYahav 1 Previously static analysis over-approximation of program behavior abstract interpretation abstraction, transformers,

More information

Using Relaxed Consistency Models

Using Relaxed Consistency Models Using Relaxed Consistency Models CS&G discuss relaxed consistency models from two standpoints. The system specification, which tells how a consistency model works and what guarantees of ordering it provides.

More information

CPSC/ECE 3220 Fall 2017 Exam Give the definition (note: not the roles) for an operating system as stated in the textbook. (2 pts.

CPSC/ECE 3220 Fall 2017 Exam Give the definition (note: not the roles) for an operating system as stated in the textbook. (2 pts. CPSC/ECE 3220 Fall 2017 Exam 1 Name: 1. Give the definition (note: not the roles) for an operating system as stated in the textbook. (2 pts.) Referee / Illusionist / Glue. Circle only one of R, I, or G.

More information

Checking a Multithreaded Algorithm with + CAL

Checking a Multithreaded Algorithm with + CAL Checking a Multithreaded Algorithm with + CAL Leslie Lamport Microsoft Research 30 Jul 2006 To appear in DISC 2006 Abstract A colleague told me about a multithreaded algorithm that was later reported to

More information

Model Requirements and JAVA Programs MVP 2 1

Model Requirements and JAVA Programs MVP 2 1 Model Requirements and JAVA Programs MVP 2 1 Traditional Software The Waterfall Model Problem Area Development Analysis REVIEWS Design Implementation Costly wrt time and money. Errors are found too late

More information

Lecture 9: Multiprocessor OSs & Synchronization. CSC 469H1F Fall 2006 Angela Demke Brown

Lecture 9: Multiprocessor OSs & Synchronization. CSC 469H1F Fall 2006 Angela Demke Brown Lecture 9: Multiprocessor OSs & Synchronization CSC 469H1F Fall 2006 Angela Demke Brown The Problem Coordinated management of shared resources Resources may be accessed by multiple threads Need to control

More information

Lindsay Groves, Simon Doherty. Mark Moir, Victor Luchangco

Lindsay Groves, Simon Doherty. Mark Moir, Victor Luchangco Lindsay Groves, Simon Doherty Victoria University of Wellington Mark Moir, Victor Luchangco Sun Microsystems, Boston (FORTE, Madrid, September, 2004) Lock-based concurrency doesn t scale Lock-free/non-blocking

More information

Multiprocessors and Locking

Multiprocessors and Locking Types of Multiprocessors (MPs) Uniform memory-access (UMA) MP Access to all memory occurs at the same speed for all processors. Multiprocessors and Locking COMP9242 2008/S2 Week 12 Part 1 Non-uniform memory-access

More information

Marwan Burelle. Parallel and Concurrent Programming

Marwan Burelle.  Parallel and Concurrent Programming marwan.burelle@lse.epita.fr http://wiki-prog.infoprepa.epita.fr Outline 1 2 3 OpenMP Tell Me More (Go, OpenCL,... ) Overview 1 Sharing Data First, always try to apply the following mantra: Don t share

More information

Synthesis of Synchronization using Uninterpreted Functions

Synthesis of Synchronization using Uninterpreted Functions Synthesis of Synchronization using Uninterpreted Functions* October 22, 2014 Roderick Bloem, Georg Hofferek, Bettina Könighofer, Robert Könighofer, Simon Außerlechner, and Raphael Spörk * This work was

More information

CHESS: Analysis and Testing of Concurrent Programs

CHESS: Analysis and Testing of Concurrent Programs CHESS: Analysis and Testing of Concurrent Programs Sebastian Burckhardt, Madan Musuvathi, Shaz Qadeer Microsoft Research Joint work with Tom Ball, Peli de Halleux, and interns Gerard Basler (ETH Zurich),

More information

Predicate Abstraction Daniel Kroening 1

Predicate Abstraction Daniel Kroening 1 Predicate Abstraction 20.1.2005 Daniel Kroening 1 Motivation Software has too many state variables State Space Explosion Graf/Saïdi 97: Predicate Abstraction Idea: Only keep track of predicates on data

More information

NON-BLOCKING DATA STRUCTURES AND TRANSACTIONAL MEMORY. Tim Harris, 31 October 2012

NON-BLOCKING DATA STRUCTURES AND TRANSACTIONAL MEMORY. Tim Harris, 31 October 2012 NON-BLOCKING DATA STRUCTURES AND TRANSACTIONAL MEMORY Tim Harris, 31 October 2012 Lecture 6 Linearizability Lock-free progress properties Queues Reducing contention Explicit memory management Linearizability

More information

The Cache-Coherence Problem

The Cache-Coherence Problem The -Coherence Problem Lecture 12 (Chapter 6) 1 Outline Bus-based multiprocessors The cache-coherence problem Peterson s algorithm Coherence vs. consistency Shared vs. Distributed Memory What is the difference

More information

The C/C++ Memory Model: Overview and Formalization

The C/C++ Memory Model: Overview and Formalization The C/C++ Memory Model: Overview and Formalization Mark Batty Jasmin Blanchette Scott Owens Susmit Sarkar Peter Sewell Tjark Weber Verification of Concurrent C Programs C11 / C++11 In 2011, new versions

More information

Concurrent Preliminaries

Concurrent Preliminaries Concurrent Preliminaries Sagi Katorza Tel Aviv University 09/12/2014 1 Outline Hardware infrastructure Hardware primitives Mutual exclusion Work sharing and termination detection Concurrent data structures

More information

Relaxed Memory-Consistency Models

Relaxed Memory-Consistency Models Relaxed Memory-Consistency Models [ 9.1] In Lecture 13, we saw a number of relaxed memoryconsistency models. In this lecture, we will cover some of them in more detail. Why isn t sequential consistency

More information

Order Is A Lie. Are you sure you know how your code runs?

Order Is A Lie. Are you sure you know how your code runs? Order Is A Lie Are you sure you know how your code runs? Order in code is not respected by Compilers Processors (out-of-order execution) SMP Cache Management Understanding execution order in a multithreaded

More information

Brushing the Locks out of the Fur: A Lock-Free Work Stealing Library Based on Wool

Brushing the Locks out of the Fur: A Lock-Free Work Stealing Library Based on Wool Brushing the Locks out of the Fur: A Lock-Free Work Stealing Library Based on Wool Håkan Sundell School of Business and Informatics University of Borås, 50 90 Borås E-mail: Hakan.Sundell@hb.se Philippas

More information

Foundations of the C++ Concurrency Memory Model

Foundations of the C++ Concurrency Memory Model Foundations of the C++ Concurrency Memory Model John Mellor-Crummey and Karthik Murthy Department of Computer Science Rice University johnmc@rice.edu COMP 522 27 September 2016 Before C++ Memory Model

More information

Abstract Semantic Differencing for Numerical Programs

Abstract Semantic Differencing for Numerical Programs Abstract Semantic Differencing for Numerical Programs Nimrod Partush Eran Yahav Technion, Israel Semantic differencing Characterize semantic difference between similar programs 2 Motivating example 1.

More information

Distributed Computing Group

Distributed Computing Group Distributed Computing Group HS 2009 Prof. Dr. Roger Wattenhofer, Thomas Locher, Remo Meier, Benjamin Sigg Assigned: December 11, 2009 Discussion: none Distributed Systems Theory exercise 6 1 ALock2 Have

More information

Distributed Operating Systems

Distributed Operating Systems Distributed Operating Systems Synchronization in Parallel Systems Marcus Völp 2009 1 Topics Synchronization Locking Analysis / Comparison Distributed Operating Systems 2009 Marcus Völp 2 Overview Introduction

More information

Design of Concurrent and Distributed Data Structures

Design of Concurrent and Distributed Data Structures METIS Spring School, Agadir, Morocco, May 2015 Design of Concurrent and Distributed Data Structures Christoph Kirsch University of Salzburg Joint work with M. Dodds, A. Haas, T.A. Henzinger, A. Holzer,

More information

Design and Analysis of Distributed Interacting Systems

Design and Analysis of Distributed Interacting Systems Design and Analysis of Distributed Interacting Systems Lecture 5 Linear Temporal Logic (cont.) Prof. Dr. Joel Greenyer May 2, 2013 (Last Time:) LTL Semantics (Informally) LTL Formulae are interpreted on

More information

NON-BLOCKING DATA STRUCTURES AND TRANSACTIONAL MEMORY. Tim Harris, 17 November 2017

NON-BLOCKING DATA STRUCTURES AND TRANSACTIONAL MEMORY. Tim Harris, 17 November 2017 NON-BLOCKING DATA STRUCTURES AND TRANSACTIONAL MEMORY Tim Harris, 17 November 2017 Lecture 7 Linearizability Lock-free progress properties Hashtables and skip-lists Queues Reducing contention Explicit

More information

The concept of concurrency is fundamental to all these areas.

The concept of concurrency is fundamental to all these areas. Chapter 5 Concurrency(I) The central themes of OS are all concerned with the management of processes and threads: such as multiprogramming, multiprocessing, and distributed processing. The concept of concurrency

More information

G52CON: Concepts of Concurrency

G52CON: Concepts of Concurrency G52CON: Concepts of Concurrency Lecture 4: Atomic Actions Natasha Alechina School of Computer Science nza@cs.nott.ac.uk Outline of the lecture process execution fine-grained atomic actions using fine-grained

More information

Reminder from last time

Reminder from last time Concurrent systems Lecture 7: Crash recovery, lock-free programming, and transactional memory DrRobert N. M. Watson 1 Reminder from last time History graphs; good (and bad) schedules Isolation vs. strict

More information

4/6/2011. Model Checking. Encoding test specifications. Model Checking. Encoding test specifications. Model Checking CS 4271

4/6/2011. Model Checking. Encoding test specifications. Model Checking. Encoding test specifications. Model Checking CS 4271 Mel Checking LTL Property System Mel Mel Checking CS 4271 Mel Checking OR Abhik Roychoudhury http://www.comp.nus.edu.sg/~abhik Yes No, with Counter-example trace 2 Recap: Mel Checking for mel-based testing

More information

Partial-Coherence Abstractions for Relaxed Memory Models

Partial-Coherence Abstractions for Relaxed Memory Models Partial-Coherence Abstractions for Relaxed Memory Models Michael Kuperstein Technion, Haifa, Israel mkuper@cs.technion.ac.il Martin Vechev IBM T.J. Watson Research Center mtvechev@us.ibm.com Eran Yahav

More information

Sistemi in tempo reale Anno accademico

Sistemi in tempo reale Anno accademico Sistemi in tempo reale Anno accademico 2006-2007 Concorrenza - II Giuseppe Lipari http://feanor.sssup.it/~lipari Scuola Superiore Sant Anna Outline 1 Introduction to concurrency 2 Models of concurrency:

More information

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING UNIT-1

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING UNIT-1 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Year & Semester : III/VI Section : CSE-1 & CSE-2 Subject Code : CS2354 Subject Name : Advanced Computer Architecture Degree & Branch : B.E C.S.E. UNIT-1 1.

More information

NON-BLOCKING DATA STRUCTURES AND TRANSACTIONAL MEMORY. Tim Harris, 21 November 2014

NON-BLOCKING DATA STRUCTURES AND TRANSACTIONAL MEMORY. Tim Harris, 21 November 2014 NON-BLOCKING DATA STRUCTURES AND TRANSACTIONAL MEMORY Tim Harris, 21 November 2014 Lecture 7 Linearizability Lock-free progress properties Queues Reducing contention Explicit memory management Linearizability

More information

MEMORY MODEL SENSITIVE ANALYSIS OF CONCURRENT DATA TYPES. Sebastian Burckhardt. Computer and Information Science

MEMORY MODEL SENSITIVE ANALYSIS OF CONCURRENT DATA TYPES. Sebastian Burckhardt. Computer and Information Science MEMORY MODEL SENSITIVE ANALYSIS OF CONCURRENT DATA TYPES Sebastian Burckhardt A DISSERTATION in Computer and Information Science Presented to the Faculties of the University of Pennsylvania in Partial

More information

Lecture: Coherence and Synchronization. Topics: synchronization primitives, consistency models intro (Sections )

Lecture: Coherence and Synchronization. Topics: synchronization primitives, consistency models intro (Sections ) Lecture: Coherence and Synchronization Topics: synchronization primitives, consistency models intro (Sections 5.4-5.5) 1 Performance Improvements What determines performance on a multiprocessor: What fraction

More information

CS 5220: Shared memory programming. David Bindel

CS 5220: Shared memory programming. David Bindel CS 5220: Shared memory programming David Bindel 2017-09-26 1 Message passing pain Common message passing pattern Logical global structure Local representation per processor Local data may have redundancy

More information

Cache-Aware Lock-Free Queues for Multiple Producers/Consumers and Weak Memory Consistency

Cache-Aware Lock-Free Queues for Multiple Producers/Consumers and Weak Memory Consistency Cache-Aware Lock-Free Queues for Multiple Producers/Consumers and Weak Memory Consistency Anders Gidenstam Håkan Sundell Philippas Tsigas School of business and informatics University of Borås Distributed

More information

Concurrent Libraries with Foresight

Concurrent Libraries with Foresight Concurrent Libraries with Foresight Guy Golan-Gueta Tel Aviv University ggolan@tau.ac.il G. Ramalingam Microsoft Research grama@microsoft.com Mooly Sagiv Tel Aviv University msagiv@tau.ac.il Eran Yahav

More information

SPIN, PETERSON AND BAKERY LOCKS

SPIN, PETERSON AND BAKERY LOCKS Concurrent Programs reasoning about their execution proving correctness start by considering execution sequences CS4021/4521 2018 jones@scss.tcd.ie School of Computer Science and Statistics, Trinity College

More information

Improving the Practicality of Transactional Memory

Improving the Practicality of Transactional Memory Improving the Practicality of Transactional Memory Woongki Baek Electrical Engineering Stanford University Programming Multiprocessors Multiprocessor systems are now everywhere From embedded to datacenter

More information

Fine-grained synchronization & lock-free programming

Fine-grained synchronization & lock-free programming Lecture 17: Fine-grained synchronization & lock-free programming Parallel Computer Architecture and Programming CMU 15-418/15-618, Spring 2016 Tunes Minnie the Moocher Robbie Williams (Swings Both Ways)

More information

ROEVER ENGINEERING COLLEGE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

ROEVER ENGINEERING COLLEGE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING ROEVER ENGINEERING COLLEGE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 16 MARKS CS 2354 ADVANCE COMPUTER ARCHITECTURE 1. Explain the concepts and challenges of Instruction-Level Parallelism. Define

More information

Simplifying Loop Invariant Generation Using Splitter Predicates. Rahul Sharma Işil Dillig, Thomas Dillig, and Alex Aiken Stanford University

Simplifying Loop Invariant Generation Using Splitter Predicates. Rahul Sharma Işil Dillig, Thomas Dillig, and Alex Aiken Stanford University Simplifying Loop Invariant Generation Using Splitter Predicates Rahul Sharma Işil Dillig, Thomas Dillig, and Alex Aiken Stanford University Loops and Loop Invariants Loop Head x = 0; while( x

More information

Semantic Atomicity for Multithreaded Programs!

Semantic Atomicity for Multithreaded Programs! P A R A L L E L C O M P U T I N G L A B O R A T O R Y Semantic Atomicity for Multithreaded Programs! Jacob Burnim, George Necula, Koushik Sen! Parallel Computing Laboratory! University of California, Berkeley!

More information

Dept. of CSE, York Univ. 1

Dept. of CSE, York Univ. 1 EECS 3221.3 Operating System Fundamentals No.5 Process Synchronization(1) Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University Background: cooperating processes with shared

More information

Transactional Memory: Architectural Support for Lock-Free Data Structures Maurice Herlihy and J. Eliot B. Moss ISCA 93

Transactional Memory: Architectural Support for Lock-Free Data Structures Maurice Herlihy and J. Eliot B. Moss ISCA 93 Transactional Memory: Architectural Support for Lock-Free Data Structures Maurice Herlihy and J. Eliot B. Moss ISCA 93 What are lock-free data structures A shared data structure is lock-free if its operations

More information

CS377P Programming for Performance Multicore Performance Synchronization

CS377P Programming for Performance Multicore Performance Synchronization CS377P Programming for Performance Multicore Performance Synchronization Sreepathi Pai UTCS October 21, 2015 Outline 1 Synchronization Primitives 2 Blocking, Lock-free and Wait-free Algorithms 3 Transactional

More information

Stanford University Computer Science Department CS 140 Midterm Exam Dawson Engler Winter 1999

Stanford University Computer Science Department CS 140 Midterm Exam Dawson Engler Winter 1999 Stanford University Computer Science Department CS 140 Midterm Exam Dawson Engler Winter 1999 Name: Please initial the bottom left corner of each page. This is an open-book exam. You have 50 minutes to

More information

Tom Ball Sebastian Burckhardt Madan Musuvathi Microsoft Research

Tom Ball Sebastian Burckhardt Madan Musuvathi Microsoft Research Tom Ball (tball@microsoft.com) Sebastian Burckhardt (sburckha@microsoft.com) Madan Musuvathi (madanm@microsoft.com) Microsoft Research P&C Parallelism Concurrency Performance Speedup Responsiveness Correctness

More information

Fine-grained synchronization & lock-free data structures

Fine-grained synchronization & lock-free data structures Lecture 19: Fine-grained synchronization & lock-free data structures Parallel Computer Architecture and Programming Redo Exam statistics Example: a sorted linked list struct Node { int value; Node* next;

More information

Formal Specification and Verification

Formal Specification and Verification Formal Specification and Verification Introduction to Promela Bernhard Beckert Based on a lecture by Wolfgang Ahrendt and Reiner Hähnle at Chalmers University, Göteborg Formal Specification and Verification:

More information

An introduction to weak memory consistency and the out-of-thin-air problem

An introduction to weak memory consistency and the out-of-thin-air problem An introduction to weak memory consistency and the out-of-thin-air problem Viktor Vafeiadis Max Planck Institute for Software Systems (MPI-SWS) CONCUR, 7 September 2017 Sequential consistency 2 Sequential

More information

Linearizability of Persistent Memory Objects

Linearizability of Persistent Memory Objects Linearizability of Persistent Memory Objects Michael L. Scott Joint work with Joseph Izraelevitz & Hammurabi Mendes www.cs.rochester.edu/research/synchronization/ Workshop on the Theory of Transactional

More information

Part 3: Beyond Reduction

Part 3: Beyond Reduction Lightweight Analyses For Reliable Concurrency Part 3: Beyond Reduction Stephen Freund Williams College joint work with Cormac Flanagan (UCSC), Shaz Qadeer (MSR) Busy Acquire Busy Acquire void busy_acquire()

More information

CSE 153 Design of Operating Systems

CSE 153 Design of Operating Systems CSE 153 Design of Operating Systems Winter 19 Lecture 7/8: Synchronization (1) Administrivia How is Lab going? Be prepared with questions for this weeks Lab My impression from TAs is that you are on track

More information

Potential violations of Serializability: Example 1

Potential violations of Serializability: Example 1 CSCE 6610:Advanced Computer Architecture Review New Amdahl s law A possible idea for a term project Explore my idea about changing frequency based on serial fraction to maintain fixed energy or keep same

More information

Crash Course in Applied PL

Crash Course in Applied PL Crash Course in Applied PL (with applications to Networks) Software Reliability Lab Department of Computer Science ETH Zurich Overview of Applied PL techniques Static Analysis Program Synthesis ibgp, OSPF,

More information

Software Engineering using Formal Methods

Software Engineering using Formal Methods Software Engineering using Formal Methods Introduction to Promela Wolfgang Ahrendt & Richard Bubel & Reiner Hähnle & Wojciech Mostowski 31 August 2011 SEFM: Promela /GU 110831 1 / 35 Towards Model Checking

More information

Intermediate Code Generation

Intermediate Code Generation Intermediate Code Generation In the analysis-synthesis model of a compiler, the front end analyzes a source program and creates an intermediate representation, from which the back end generates target

More information

Synchronizing the Asynchronous

Synchronizing the Asynchronous Synchronizing the Asynchronous Bernhard Kragl IST Austria Shaz Qadeer Microsoft Thomas A. Henzinger IST Austria Concurrency is Ubiquitous Asynchronous Concurrency is Ubiquitous Asynchronous programs are

More information

Duet: Static Analysis for Unbounded Parallelism

Duet: Static Analysis for Unbounded Parallelism Duet: Static Analysis for Unbounded Parallelism Azadeh Farzan and Zachary Kincaid University of Toronto Abstract. Duet is a static analysis tool for concurrent programs in which the number of executing

More information

Non-blocking Array-based Algorithms for Stacks and Queues. Niloufar Shafiei

Non-blocking Array-based Algorithms for Stacks and Queues. Niloufar Shafiei Non-blocking Array-based Algorithms for Stacks and Queues Niloufar Shafiei Outline Introduction Concurrent stacks and queues Contributions New algorithms New algorithms using bounded counter values Correctness

More information

Automatic Verification of RMA Programs via Abstraction Extrapolation

Automatic Verification of RMA Programs via Abstraction Extrapolation Automatic Verification of RMA Programs via Abstraction Extrapolation Cedric Baumann 1, Andrei Marian Dan 1, Yuri Meshman 2, Torsten Hoefler 1, and Martin Vechev 1 1 Department of Computer Science, ETH

More information

Having a BLAST with SLAM

Having a BLAST with SLAM Having a BLAST with SLAM Meeting, CSCI 555, Fall 20 Announcements Homework 0 due Sat Questions? Move Tue office hours to -5pm 2 Software Model Checking via Counterexample Guided Abstraction Refinement

More information

AST: scalable synchronization Supervisors guide 2002

AST: scalable synchronization Supervisors guide 2002 AST: scalable synchronization Supervisors guide 00 tim.harris@cl.cam.ac.uk These are some notes about the topics that I intended the questions to draw on. Do let me know if you find the questions unclear

More information

Lecture 6. Abstract Interpretation

Lecture 6. Abstract Interpretation Lecture 6. Abstract Interpretation Wei Le 2014.10 Outline Motivation History What it is: an intuitive understanding An example Steps of abstract interpretation Galois connection Narrowing and Widening

More information

Lock free Algorithm for Multi-core architecture. SDY Corporation Hiromasa Kanda SDY

Lock free Algorithm for Multi-core architecture. SDY Corporation Hiromasa Kanda SDY Lock free Algorithm for Multi-core architecture Corporation Hiromasa Kanda 1.Introduction Background needed Multi-Thread Problem of Multi-Thread program What's Lock free? Lock-free algorithm performance

More information

Static Analysis of Embedded C

Static Analysis of Embedded C Static Analysis of Embedded C John Regehr University of Utah Joint work with Nathan Cooprider Motivating Platform: TinyOS Embedded software for wireless sensor network nodes Has lots of SW components for

More information

Multiprocessor Cache Coherence. Chapter 5. Memory System is Coherent If... From ILP to TLP. Enforcing Cache Coherence. Multiprocessor Types

Multiprocessor Cache Coherence. Chapter 5. Memory System is Coherent If... From ILP to TLP. Enforcing Cache Coherence. Multiprocessor Types Chapter 5 Multiprocessor Cache Coherence Thread-Level Parallelism 1: read 2: read 3: write??? 1 4 From ILP to TLP Memory System is Coherent If... ILP became inefficient in terms of Power consumption Silicon

More information

COMP Parallel Computing. CC-NUMA (2) Memory Consistency

COMP Parallel Computing. CC-NUMA (2) Memory Consistency COMP 633 - Parallel Computing Lecture 11 September 26, 2017 Memory Consistency Reading Patterson & Hennesey, Computer Architecture (2 nd Ed.) secn 8.6 a condensed treatment of consistency models Coherence

More information

The Sketching Approach to Program Synthesis

The Sketching Approach to Program Synthesis The Sketching Approach to Program Synthesis Armando Solar-Lezama Massachusetts Institute of Technology Abstract. Sketching is a new form of localized software synthesis that aims to bridge the gap between

More information

Software Security: Vulnerability Analysis

Software Security: Vulnerability Analysis Computer Security Course. Software Security: Vulnerability Analysis Program Verification Program Verification How to prove a program free of buffer overflows? Precondition Postcondition Loop invariants

More information

Declarative semantics for concurrency. 28 August 2017

Declarative semantics for concurrency. 28 August 2017 Declarative semantics for concurrency Ori Lahav Viktor Vafeiadis 28 August 2017 An alternative way of defining the semantics 2 Declarative/axiomatic concurrency semantics Define the notion of a program

More information

NDSeq: Runtime Checking for Nondeterministic Sequential Specs of Parallel Correctness

NDSeq: Runtime Checking for Nondeterministic Sequential Specs of Parallel Correctness EECS Electrical Engineering and Computer Sciences P A R A L L E L C O M P U T I N G L A B O R A T O R Y NDSeq: Runtime Checking for Nondeterministic Sequential Specs of Parallel Correctness Jacob Burnim,

More information

Software Engineering using Formal Methods

Software Engineering using Formal Methods Software Engineering using Formal Methods Introduction to Promela Wolfgang Ahrendt 03 September 2015 SEFM: Promela /GU 150903 1 / 36 Towards Model Checking System Model Promela Program byte n = 0; active

More information