Characterizing Progress Properties of Concurrent Objects via Contextual Refinements Hongjin Liang Univ. of Science and Technology of China (USTC) Joint.

Slides:



Advertisements
Similar presentations
Hongjin Liang and Xinyu Feng
Advertisements

Refinement Verification of Concurrent Programs and Its Applications Hongjin Liang Univ. of Science and Technology of China Advisors: Xinyu Feng and Zhong.
TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A A A AAA A A A AA A Proving that non-blocking algorithms don't block.
Translation-Based Compositional Reasoning for Software Systems Fei Xie and James C. Browne Robert P. Kurshan Cadence Design Systems.
Giving a formal meaning to “Specialization” In these note we try to give a formal meaning to specifications, implementations, their comparisons. We define.
A Rely-Guarantee-Based Simulation for Verifying Concurrent Program Transformations Hongjin Liang, Xinyu Feng & Ming Fu Univ. of Science and Technology.
D u k e S y s t e m s Time, clocks, and consistency and the JMM Jeff Chase Duke University.
Mutual Exclusion By Shiran Mizrahi. Critical Section class Counter { private int value = 1; //counter starts at one public Counter(int c) { //constructor.
Parallel Inclusion-based Points-to Analysis Mario Méndez-Lojo Augustine Mathew Keshav Pingali The University of Texas at Austin (USA) 1.
A Mile-High View of Concurrent Algorithms Hagit Attiya Technion.
Progress Guarantee for Parallel Programs via Bounded Lock-Freedom Erez Petrank – Technion Madanlal Musuvathi- Microsoft Bjarne Steensgaard - Microsoft.
Modular Verification of Concurrent Assembly Code with Dynamic Thread Creation and Termination Xinyu Feng Yale University Joint work with Zhong Shao.
Assignment – no class Wednesday All: watch the Google Techtalk “Getting C++ Threads Right” by Hans Boehm at the following link in place of Wednesday’s.
Certifying Low-Level Programs with Hardware Interrupts and Preemptive Threads Xinyu Feng Toyota Technological Institute at Chicago Joint work with Zhong.
Concurrency CS 510: Programming Languages David Walker.
An Open Framework for Foundational Proof-Carrying Code Xinyu Feng Yale University Joint work with Zhaozhong Ni (Yale, now at MSR), Zhong Shao (Yale) and.
Modular Verification of Assembly Code with Stack-Based Control Abstractions Xinyu Feng Yale University Joint work with Zhong Shao, Alexander Vaynberg,
On the Relationship Between Concurrent Separation Logic and Assume-Guarantee Reasoning Xinyu Feng Yale University Joint work with Rodrigo Ferreira and.
Transaction Processing: Concurrency and Serializability 10/4/05.
1 Ivan Lanese Computer Science Department University of Bologna Italy Concurrent and located synchronizations in π-calculus.
CS 711 Fall 2002 Programming Languages Seminar Andrew Myers 2. Noninterference 4 Sept 2002.
Memory Model Safety of Programs Sebastian Burckhardt Madanlal Musuvathi Microsoft Research EC^2, July 7, 2008.
*Department of Computing Science University of Newcastle upon Tyne **Institut für Informatik, Universität Augsburg Canonical Prefixes of Petri Net Unfoldings.
Comparison Under Abstraction for Verifying Linearizability Daphna Amit Noam Rinetzky Mooly Sagiv Tom RepsEran Yahav Tel Aviv UniversityUniversity of Wisconsin.
SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas.
A Formal Model of Modularity in Aspect-Oriented Programming Jonathan Aldrich : Objects and Aspects Carnegie Mellon University.
Compositional Verification of Termination-Preserving Refinement of Concurrent Programs Hongjin Liang Univ. of Science and Technology of China (USTC) Joint.
Linear and Branching Time Safety, Liveness, and Fairness
© 2009 Matthew J. Sottile, Timothy G. Mattson, and Craig E Rasmussen 1 Concurrency in Programming Languages Matthew J. Sottile Timothy G. Mattson Craig.
Parallel Programming Philippas Tsigas Chalmers University of Technology Computer Science and Engineering Department © Philippas Tsigas.
Verifying Concurrent Objects under Fair Scheduling Hongjin Liang University of Science and Technology of China (USTC) Joint work with Xinyu Feng.
Linearizability By Mila Oren 1. Outline  Sequential and concurrent specifications.  Define linearizability (intuition and formal model).  Composability.
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 3 (26/01/2006) Instructor: Haifeng YU.
Yang Liu, Jun Sun and Jin Song Dong School of Computing National University of Singapore.
Verification and Validation in the Context of Domain-Specific Modelling Janne Merilinna.
Concurrency Verification. Why concurrency verification Concurrent programs show in many systems –Multi-task support in OS kernels –Handling interrupts.
A Consistency Framework for Iteration Operations in Concurrent Data Structures Yiannis Nikolakopoulos A. Gidenstam M. Papatriantafilou P. Tsigas Distributed.
Chapter 8 Object Design Reuse and Patterns. Object Design Object design is the process of adding details to the requirements analysis and making implementation.
UW CSE 503 ▪ Software Engineering ▪ Spring 2004 ▪ Rob DeLine1 CSE 503 – Software Engineering Lecture 7: Process calculi and refinement Rob DeLine 19 Apr.
Eran Yahav 1. Previously…  An algorithmic view  Abstract data types (ADT)  Correctness Conditions  Sequential consistency  Linearizability  Treiber’s.
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
A Methodology for Creating Fast Wait-Free Data Structures Alex Koganand Erez Petrank Computer Science Technion, Israel.
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.
Model Checking Linearizability via Refinement 1 ICFEM 2008 Model Checking Linearizability via Refinement Yang LIU, Wei CHEN, Yanhong A. LIU, and Jun SUN.
Software Transactional Memory Should Not Be Obstruction-Free Robert Ennals Presented by Abdulai Sei.
A Program Logic for Concurrent Objects under Fair Scheduling Hongjin Liang and Xinyu Feng University of Science and Technology of China (USTC) To appear.
Program Logic for Concurrency Refinement Verification Xinyu Feng University of Science and Technology of China Joint work with Hongjin Liang (USTC) and.
Techniques and Structures in Concurrent Programming Wilfredo Velazquez.
CSE 331 Software Design & Implementation Dan Grossman Fall 2014 Abstraction Functions (Based on slides by Mike Ernst, David Notkin, Hal Perkins)
Model Checking Lecture 1. Model checking, narrowly interpreted: Decision procedures for checking if a given Kripke structure is a model for a given formula.
A Calculus of Atomic Actions Tayfun Elmas, Shaz Qadeer and Serdar Tasiran POPL ‘ – Seminar in Distributed Algorithms Cynthia Disenfeld 27/05/2013.
Concurrent Computing Seminar Introductory Lecture Instructor: Danny Hendler
Scalable lock-free Stack Algorithm Wael Yehia York University February 8, 2010.
Verifying Component Substitutability Nishant Sinha Sagar Chaki Edmund Clarke Natasha Sharygina Carnegie Mellon University.
Model Checking Lecture 1: Specification Tom Henzinger.
Simplifying Linearizability Proofs Using Reduction and Abstraction Serdar Tasiran Koc University, Istanbul, Turkey Tayfun Elmas, Ali Sezgin, Omer Subasi.
Reasoning and Design (and Assertions). How to Design Your Code The hard way: Just start coding. When something doesn’t work, code some more! The easier.
A Program Logic for Concurrent Objects under Fair Scheduling Hongjin Liang and Xinyu Feng University of Science and Technology of China (USTC)
6.852 Lecture 21 ● Techniques for highly concurrent objects – coarse-grained mutual exclusion – read/write locking – fine-grained locking (mutex and read/write)
An Operational Approach to Relaxed Memory Models
Multicore Programming Final Review
Concurrent Objects Companion slides for
Joint work with Yong Li, Xinyu Feng, Zhong Shao and Yu Zhang
Hongjin Liang, Xinyu Feng & Ming Fu
Distributed Algorithms (22903)
Progress of Concurrent Objects with Partial Methods
Multicore programming
Non-preemptive Semantics for Data-race-free Programs
CSE 331 Software Design & Implementation
Presentation transcript:

Characterizing Progress Properties of Concurrent Objects via Contextual Refinements Hongjin Liang Univ. of Science and Technology of China (USTC) Joint work with Jan Hoffmann (Yale), Xinyu Feng (USTC), Zhong Shao (Yale)

Whole program C[O] … push(7); x = pop(); … push(6); … Client code C Concurrent object O java.util.concurrent void push(int v) { … } … int pop() { … } Modern languages provide concurrent objects (libraries) to help program for multicore systems.

Example: Treiber’s Non-Blocking Stack … v1 next vk next Top push(int v): 1 local b:=false, x, t; 2 x := new Node(); 3 x.data := v; 4 while(!b){ 5 t := Top; 6 x.next := t; 7 b := cas(&Top, t, x); 8 } next t x v How to specify/prove correctness? [Treiber’86]

Correctness Linearizability – Correctness w.r.t. functionality – Not talk about termination/liveness properties Progress properties – Lock-freedom (LF) – Wait-freedom (WF) – Obstruction-freedom (OF) – Deadlock-freedom (DF) – Starvation-freedom (SF) Non-blocking impl. Lock-based impl.

Difficult to use for modular verification because they fail to describe how clients are affected Problem

Modular Verification Don’t want to consider the internals of O while reasoning about its client Instead of reasoning about C[O], we reason about C[S], as long as C[O] is as good as C[S] – Same outputs – Same termination behavior Client C void push(int v) { … } int pop() { … } Object O Client C Specification S push pop Not specified by linearizability/progress!

Our Contributions A framework based on contextual refinement (CR) – Propose different termination-sensitive CR Equivalent to linearizability + progress Unify all five progress properties (LF, WF, OF, DF, SF) – Show how different progress properties affect client termination  make modular verification easier – Allow us to borrow existing ideas on CR proof to verify linearizability + progress  potential to have a generic verification framework

Review of Linearizability Standard safety criterion for objects O Defined from implementation point of view – Describe objects’ behaviors instead of clients’ – Intentional instead of extensional O  lin S : Every concurrent execution of O is “equivalent” to some sequential execution of spec S E.g. Treiber stack [Herlihy & Wing’90]

A concurrent execution of O: Thread 1: Thread 2: retpush(7) retpush(6) ret (7)pop() time push(6), ret, push(7), ret, pop(), ret(7) Sequential execution of S Linearizability of Object O Describe objects’ behaviors instead of clients’

… x := 7; push( x ); … y := pop(); print(y); … Client C Concrete obj. O Abstract obj. S Is behavior of C[O] the same as C[S]? Another Correctness Criterion void push(int v) { … } int pop() { … } push pop

Contextual Refinement O  ctxt S iff  C. ObsBeh(C[O])  ObsBeh(C[S]) Observable behaviors (e.g. prefix closures of I/O event traces)

Linearizability & Contextual Refinement O  lin S “  ”: we can view C[O] as C[S] – The latter is simpler to understand/verify “  ”: all proof methods for  ctxt can verify  lin –  ctxt is a well-studied concept in PL community (still challenging though) Theorem (equivalence): O  ctxt S  Proof follows [Filipovic et al., 2009]

Progress Properties Describe whether methods eventually return Defined similarly to linearizablity – Describe objects’ behaviors instead of clients’ – Intentional instead of extensional – E.g. there always exists a method call that’ll return Can we use contextual refinement to define progress properties?

Our Results Termination-sensitive contextual refinement O  P S ( iff  C. ObsBeh(C[O])  ObsBeh(C[S]) ) Linearizability O  lin S  Progress P(O)  PLFWFOFDFSF ObsBeh(C[O])divt-divi-divf-divf-t-div ObsBeh(C[S])divt-divdiv t-div LF div

Lock-Freedom Some must return Thread 1: Thread 2: Thread 3: push(7) pop() push(6)

Lock-Free Example: Treiber Stack push(v): 1 local b:=false, x, t; 2 x := new Node(v); 3 while(!b){ 4 t := Top; 5 x.next := t; 6 b := cas(&Top, t, x); 7 } … v1 next vk next Top There’s always a stack operation that will return.

Contextual Refinement for LF O  LF S iff  C. ObsBeh div (C[O])  ObsBeh div (C[S]) full event traces, not prefix closures If C[O] diverges (not terminates), C[S] must also diverge.

Non-Lock-Free Example inc() { while (i < 10) i ++; x++; } dec() { while (i > 0) i --; x--; } Neither returns Thread 1: Thread 2: inc() dec() i++; i--; i++; i--;

Non-Lock-Free Example inc() { while (i < 10) i ++; x++; } dec() { while (i > 0) i --; x--; } inc dec Client C ObsBeh div ( C[S] ):{ 2 } ObsBeh div ( C[O] ): { , 2 } inc ();dec (); print ( 2 );  Concrete object O Abstract object S We observe divergence of C[O] & C[S]

Our Results Termination-sensitive contextual refinement O  P S ( iff  C. ObsBeh(C[O])  ObsBeh(C[S]) ) Linearizability O  lin S  Progress P(O)  PLFWFOFDFSF ObsBeh(C[O])divt-divi-divf-divf-t-div ObsBeh(C[S])divt-divdiv t-div WF t-div LF div

Wait-Freedom Must return O  WF S iff  C. ObsBeh t-div (C[O])  ObsBeh t-div (C[S]) full event traces & diverging threads Thread 1: Thread 2: Thread 3: push(7) pop() push(6)

Example: Treiber Stack is Not Wait-Free push(v): 1 local b:=false, x, t; 2 x := new Node(v); 3 while(!b){ 4 t := Top; 5 x.next := t; 6 b := cas(&Top, t, x); 7 } push( 7 ) may not return T1: T2: push(7) retpush(4) …… push ( 7 ); while( true ) push ( 4 ); T1T2

Treiber Stack does Not satisfy O  WF S push pop Abstract stack S void push(int v) { … } int pop() { … } Treiber stack O ObsBeh t-div ( C[S] ): { ( , {T2}) } ObsBeh t-div ( C[O] ): { ( , {T2}), ( , {T1, T2}) }  push ( 7 ); while( true ) push ( 4 ); T1T2 Full I/O trace set of diverging threads We observe individual threads’ divergence

Our Results Termination-sensitive contextual refinement O  P S ( iff  C. ObsBeh(C[O])  ObsBeh(C[S]) ) Linearizability O  lin S  Progress P(O)  PLFWFOFDFSF ObsBeh(C[O])divt-divi-divf-divf-t-div ObsBeh(C[S])divt-divdiv t-div WF t-div LF div

Other Progress Properties Obstruction-freedom – Every pending method must return if it eventually executes in isolation – Weaker than lock-freedom – CR: Observe whole program divergence, but restrict to isolating executions at concrete level

Other Progress Properties Deadlock-freedom – Lock-freedom under fair scheduling – CR: observe whole program divergence but restrict to fair executions at concrete level Starvation-freedom – Wait-freedom under fair scheduling – CR: observe individual threads’ divergence but restrict to fair executions at concrete level every thread gets eventually executed

Our Results Termination-sensitive contextual refinement O  P S ( iff  C. ObsBeh(C[O])  ObsBeh(C[S]) ) Linearizability O  lin S  Progress P(O)  PLFWFOFDFSF ObsBeh(C[O])divt-divi-divf-divf-t-div ObsBeh(C[S])divt-divdiv t-div

Relationships between Progress Properties Wait- freedom Lock- freedom Starvation- freedom Obstruction- freedom Deadlock- freedom + Linearizability  WF  LF  SF  OF  DF equiv. to

Conclusion Existing correctness definitions are intentional We use contextual refinement as a unifying framework – Different correctness properties correspond to different observable behaviors – Extensional: describes effects over clients (useful for modular verification) – Borrow existing ideas on CR proof to verify linearizability + progress — future work

BACKUP SLIDES

while (true) { }; no_op : NO_OP : skip; We allow no_op  ctxt NO_OP Context C:print( 1 ); [ _ ] print( 2 ); ObsBeh( C[NO_OP] ): { , 1, 12 } ObsBeh( C[no_op] ): { , 1}  O  ctxt S does Not specify Progress

while (true) { }; no_op : NO_OP : skip; We allow no_op  ctxt NO_OP Context C:print( 1 ); [ _ ] print( 2 ); ObsBeh div ( C[NO_OP] ): { 12 } ObsBeh div ( C[no_op] ): { 1 } O  LF S vs. O  ctxt S But no_op  LF NO_OP 

Observe Individual Threads’ Divergence void push(int v) { … } int pop() { … } Treiber stack O ObsBeh t-div ( C[O] ): { ( , {T2}), ( , {T1, T2}) } push ( 7 ); while( true ) push ( 4 ); T1T2 Full execution trace: (T1, push, 7) :: (T2, clt) :: (T2, push, 4) :: (T2, obj) :: (T1, obj) :: … :: (T2, ret) :: (T1, obj) :: (T2, clt) :: (T2, push, 4) :: (T2, obj) :: (T1, obj) :: …

Divergence vs. Termination T1 || T2 always diverges; never terminates T1 never diverges; but may not be scheduled (may not terminate) x := x + 1;while( true ) {}; T1T2

Related Work Fossati et al. CONCUR’12: –  -calculus – “observational approximations” for LF & WF are strictly weaker – not formulate DF & SF – no “observational approximation” for OF Gotsman & Yang ICALP’11: – new linearizability def that preserves lock-freedom