lecture 2 verification of concurrent programs
play

Lecture 2: Verification of Concurrent Programs Part 2: Under - PowerPoint PPT Presentation

Lecture 2: Verification of Concurrent Programs Part 2: Under Approximate Analysis Ahmed Bouajjani LIAFA, University Paris Diderot Paris 7 VTSA, MPI-Saarbr ucken, September 2012 A. Bouajjani (LIAFA, UP7) Lecture 2: Concurrent Programs


  1. Lecture 2: Verification of Concurrent Programs Part 2: Under Approximate Analysis Ahmed Bouajjani LIAFA, University Paris Diderot – Paris 7 VTSA, MPI-Saarbr¨ ucken, September 2012 A. Bouajjani (LIAFA, UP7) Lecture 2: Concurrent Programs II September 2012 1 / 18

  2. Concurrent Programs with Procedures Parallel threads (with/without procedure calls) Shared memory Interleaving semantics (sequential consistency) Model = Concurrent Pushdown Systems (Multistack systems) A. Bouajjani (LIAFA, UP7) Lecture 2: Concurrent Programs II September 2012 2 / 18

  3. Concurrent Programs with Procedures Parallel threads (with/without procedure calls) Shared memory Interleaving semantics (sequential consistency) Model = Concurrent Pushdown Systems (Multistack systems) Turing powerful: 2 threads ⇒ Restrictions: Consider only some schedules Aim: detect bugs A. Bouajjani (LIAFA, UP7) Lecture 2: Concurrent Programs II September 2012 2 / 18

  4. Concurrent Programs with Procedures Parallel threads (with/without procedure calls) Shared memory Interleaving semantics (sequential consistency) Model = Concurrent Pushdown Systems (Multistack systems) Turing powerful: 2 threads ⇒ Restrictions: Consider only some schedules Aim: detect bugs What is a good concept for restricting the set of behaviors ? A. Bouajjani (LIAFA, UP7) Lecture 2: Concurrent Programs II September 2012 2 / 18

  5. Context-Bounded Analysis [Qadeer, Rehof, 2005] The number of context switches in a computation is bounded w 0 w 1 w 1 w 2 q 0 q 1 q 2 q 3 Thread 1: u 0 u 1 u 1 q 1 q 2 q 3 Thread 2: Context 1 Context 2 Context 3 Context 4 Suitable for finding bugs in concurrent programs. Concurrency bugs show up after a small number of context switches. A. Bouajjani (LIAFA, UP7) Lecture 2: Concurrent Programs II September 2012 3 / 18

  6. Context-Bounded Analysis [Qadeer, Rehof, 2005] The number of context switches in a computation is bounded w 0 w 1 w 1 w 2 q 0 q 1 q 2 q 3 Thread 1: u 0 u 1 u 1 q 1 q 2 q 3 Thread 2: Context 1 Context 2 Context 3 Context 4 Suitable for finding bugs in concurrent programs. Concurrency bugs show up after a small number of context switches. Infinite-state space: Unbounded sequential computations Decidability ? A. Bouajjani (LIAFA, UP7) Lecture 2: Concurrent Programs II September 2012 3 / 18

  7. Basic case: Pushdown system Pushdown system = ( Q , Γ , ∆) Configuration: ( q , w ) where q ∈ Q is a control state, w ∈ Γ is the stack content. A. Bouajjani (LIAFA, UP7) Lecture 2: Concurrent Programs II September 2012 4 / 18

  8. Basic case: Pushdown system Pushdown system = ( Q , Γ , ∆) Configuration: ( q , w ) where q ∈ Q is a control state, w ∈ Γ is the stack content. Symbolic representation: A finite state automaton. Computation of the predecessors/successors: For every regular set of configurations C, the pre ∗ ( C ) and post ∗ ( C ) are regular and effectively constructible. [B¨ uchi 62], ..., [B., Esparza, Maler, 97], ... Reachability: Polynomial algorithms. Can be generalized to model checking. A. Bouajjani (LIAFA, UP7) Lecture 2: Concurrent Programs II September 2012 4 / 18

  9. Context-Bounded Analysis: Decidability Consider a multi-stack systems with n stacks Configuration: ( q , w 1 , . . . , w n ), where q is a control state, w i ∈ Γ i are stack contents. A. Bouajjani (LIAFA, UP7) Lecture 2: Concurrent Programs II September 2012 5 / 18

  10. Context-Bounded Analysis: Decidability Consider a multi-stack systems with n stacks Configuration: ( q , w 1 , . . . , w n ), where q is a control state, w i ∈ Γ i are stack contents. Symbolic representation: clusters ( q , A 1 , . . . , A n ), q a control state, A i are FSA over Γ i Given a cluster C , compute a set of clusters characterizing K - pre ∗ ( C ) (resp. K - post ∗ ( C )) A. Bouajjani (LIAFA, UP7) Lecture 2: Concurrent Programs II September 2012 5 / 18

  11. Context-Bounded Analysis: Decidability Consider a multi-stack systems with n stacks Configuration: ( q , w 1 , . . . , w n ), where q is a control state, w i ∈ Γ i are stack contents. Symbolic representation: clusters ( q , A 1 , . . . , A n ), q a control state, A i are FSA over Γ i Given a cluster C , compute a set of clusters characterizing K - pre ∗ ( C ) (resp. K - post ∗ ( C )) Generalize the pre ∗ / post ∗ constructions for PDS A. Bouajjani (LIAFA, UP7) Lecture 2: Concurrent Programs II September 2012 5 / 18

  12. Context-Bounded Analysis: Decidability Consider a multi-stack systems with n stacks Configuration: ( q , w 1 , . . . , w n ), where q is a control state, w i ∈ Γ i are stack contents. Symbolic representation: clusters ( q , A 1 , . . . , A n ), q a control state, A i are FSA over Γ i Given a cluster C , compute a set of clusters characterizing K - pre ∗ ( C ) (resp. K - post ∗ ( C )) Generalize the pre ∗ / post ∗ constructions for PDS Enumerate sequences of the form q 0 i 0 q 1 i 1 q 2 i 2 . . . i K q K i K +1 , where q j ’s are states, and i j ∈ { 1 , . . . , n } are threads identities. Let X K +1 = C . Compute: for j = K back to 0 ◮ A ′ j +1 = pre ∗ i j +1 ( X j +1 [ i j +1 ]) ∩ q j Γ ∗ i ◮ X j = ( q j , A j +1 j +1 , . . . , A j +1 , . . . , A ′ ) 1 n A. Bouajjani (LIAFA, UP7) Lecture 2: Concurrent Programs II September 2012 5 / 18

  13. Dynamic Creation of Threads ? [Atig, B., Qadeer, 09] Problem Bounding the number of context switches ⇒ bounding the number of threads. ⇒ Inadequate bounding concept for the dynamic case. Each created thread must have a chance to be executed A. Bouajjani (LIAFA, UP7) Lecture 2: Concurrent Programs II September 2012 6 / 18

  14. Dynamic Creation of Threads ? [Atig, B., Qadeer, 09] Problem Bounding the number of context switches ⇒ bounding the number of threads. ⇒ Inadequate bounding concept for the dynamic case. Each created thread must have a chance to be executed New definition Give to each thread a context switch budget ⇒ The number of context switches is bounded for each thread ⇒ The global number of context switches in a run is unbounded NB: Generalization of Asynchronous Programs A. Bouajjani (LIAFA, UP7) Lecture 2: Concurrent Programs II September 2012 6 / 18

  15. Case 1: Dynamic Networks of Finite-State Processes Decidable ? A. Bouajjani (LIAFA, UP7) Lecture 2: Concurrent Programs II September 2012 7 / 18

  16. Case 1: Dynamic Networks of Finite-State Processes Decidable ? Theorem The K-bounded state reachability problem is EXPSPACE-complete. Reduction to/from the coverability problem for Petri. A. Bouajjani (LIAFA, UP7) Lecture 2: Concurrent Programs II September 2012 7 / 18

  17. Reduction to coverability in PN For every global store q ∈ Q , associate a place q . For every stack configuration γ ∈ Γ ∪ { ǫ } and budget b ∈ { 1 , . . . , K } of the active thread, associate a place ( γ ,b,Act). For every stack configuration γ ∈ Γ ∪ { ǫ } and budget b ∈ { 0 , . . . , K } of a pending thread, associate a place ( γ ,b,Pen). A. Bouajjani (LIAFA, UP7) Lecture 2: Concurrent Programs II September 2012 8 / 18

  18. Reduction to coverability in PN For every global store q ∈ Q , associate a place q . For every stack configuration γ ∈ Γ ∪ { ǫ } and budget b ∈ { 1 , . . . , K } of the active thread, associate a place ( γ ,b,Act). For every stack configuration γ ∈ Γ ∪ { ǫ } and budget b ∈ { 0 , . . . , K } of a pending thread, associate a place ( γ ,b,Pen). q ( γ ,b,Act) = ⇒ Rule of the form: q γ − → q ′ γ ′ ( γ ′ ,b,Act) q ′ A. Bouajjani (LIAFA, UP7) Lecture 2: Concurrent Programs II September 2012 8 / 18

  19. Reduction to coverability in PN For every global store q ∈ Q , associate a place q . For every stack configuration γ ∈ Γ ∪ { ǫ } and budget b ∈ { 1 , . . . , K } of the active thread, associate a place ( γ ,b,Act). For every stack configuration γ ∈ Γ ∪ { ǫ } and budget b ∈ { 0 , . . . , K } of a pending thread, associate a place ( γ ,b,Pen). q ( γ ,b,Act) → q ′ γ ′ ⊲ γ ′′ = ⇒ Rule of the form: q γ − ( γ ′′ ,K,Pen) ( γ ′ ,b,Act) q ′ A. Bouajjani (LIAFA, UP7) Lecture 2: Concurrent Programs II September 2012 8 / 18

  20. Reduction to coverability in PN For every global store q ∈ Q , associate a place q . For every stack configuration γ ∈ Γ ∪ { ǫ } and budget b ∈ { 1 , . . . , K } of the active thread, associate a place ( γ ,b,Act). For every stack configuration γ ∈ Γ ∪ { ǫ } and budget b ∈ { 0 , . . . , K } of a pending thread, associate a place ( γ ,b,Pen). ( γ ,b,Act) ( γ ′ ,b’,Pen) Context switch (with b’ > 0) = ⇒ ( γ ′ ,b’,Act) ( γ ,b-1,Pen) A. Bouajjani (LIAFA, UP7) Lecture 2: Concurrent Programs II September 2012 8 / 18

  21. Case 2: Dynamic Networks of Pushdown Systems Decidable ? A. Bouajjani (LIAFA, UP7) Lecture 2: Concurrent Programs II September 2012 9 / 18

  22. Case 2: Dynamic Networks of Pushdown Systems Decidable ? Difficulty: ◮ Unbounded number of pending local contexts ◮ Can not use the same construction as for the case of finite state threads. (This would need an unbounded number of places.) A. Bouajjani (LIAFA, UP7) Lecture 2: Concurrent Programs II September 2012 9 / 18

Recommend


More recommend