concurrency theory
play

Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and - PowerPoint PPT Presentation

Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS Joost-Pieter Katoen and Thomas Noll Software Modeling and Verification Group RWTH Aachen University


  1. Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS Joost-Pieter Katoen and Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ws-19-20/ct/

  2. Modelling Mutual Exclusion Algorithms Outline of Lecture 7 Modelling Mutual Exclusion Algorithms Evaluating the CCS Model Model Checking Mutual Exclusion Alternative Verification Approaches Syntax of Value-Passing CCS Semantics of Value-Passing CCS Translation of Value-Passing into Pure CCS 2 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

  3. Modelling Mutual Exclusion Algorithms Peterson’s Mutual Exclusion Algorithm • Goal: ensuring exclusive access to non-shared resources • Here: two competing processes P 1 , P 2 and shared variables – b 1 , b 2 (Boolean, initially false) – b i indicates that P i wants to enter critical section – k (in { 1 , 2 } , arbitrary initial value) – index of prioritised process • P i uses local variable j := 2 − i (index of other process) 3 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

  4. Modelling Mutual Exclusion Algorithms Peterson’s Mutual Exclusion Algorithm • Goal: ensuring exclusive access to non-shared resources • Here: two competing processes P 1 , P 2 and shared variables – b 1 , b 2 (Boolean, initially false) – b i indicates that P i wants to enter critical section – k (in { 1 , 2 } , arbitrary initial value) – index of prioritised process • P i uses local variable j := 2 − i (index of other process) Algorithm 7.1 (Peterson’s algorithm for P i ) while true do “non-critical section” ; b i := true ; k := j ; while b j ∧ k = j do skip end ; “critical section” ; b i := false ; end 3 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

  5. Modelling Mutual Exclusion Algorithms Representing Shared Variables in CCS • Not directly expressible in CCS (communication by message passing) • Idea: consider variables as processes that communicate with environment by processing read/write requests 4 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

  6. Modelling Mutual Exclusion Algorithms Representing Shared Variables in CCS • Not directly expressible in CCS (communication by message passing) • Idea: consider variables as processes that communicate with environment by processing read/write requests Example 7.2 (Shared variables in Peterson’s algorithm) • Encoding of b 1 with two (process) states B 1 t (value tt) and B 1 f (ff) • Read access along ports b1rt (in state B 1 t ) and b1rf (in state B 1 f ) • Write access along ports b1wt and b1wf (in both states) 4 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

  7. Modelling Mutual Exclusion Algorithms Representing Shared Variables in CCS • Not directly expressible in CCS (communication by message passing) • Idea: consider variables as processes that communicate with environment by processing read/write requests Example 7.2 (Shared variables in Peterson’s algorithm) • Encoding of b 1 with two (process) states B 1 t (value tt) and B 1 f (ff) • Read access along ports b1rt (in state B 1 t ) and b1rf (in state B 1 f ) • Write access along ports b1wt and b1wf (in both states) • Possible behaviours: B 1 f = b1rf . B 1 f + b1wf . B 1 f + b1wt . B 1 t B 1 t = b1rt . B 1 t + b1wf . B 1 f + b1wt . B 1 t 4 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

  8. Modelling Mutual Exclusion Algorithms Representing Shared Variables in CCS • Not directly expressible in CCS (communication by message passing) • Idea: consider variables as processes that communicate with environment by processing read/write requests Example 7.2 (Shared variables in Peterson’s algorithm) • Encoding of b 1 with two (process) states B 1 t (value tt) and B 1 f (ff) • Read access along ports b1rt (in state B 1 t ) and b1rf (in state B 1 f ) • Write access along ports b1wt and b1wf (in both states) • Possible behaviours: B 1 f = b1rf . B 1 f + b1wf . B 1 f + b1wt . B 1 t B 1 t = b1rt . B 1 t + b1wf . B 1 f + b1wt . B 1 t • Similarly for b 2 and k : B 2 f = b2rf . B 2 f + b2wf . B 2 f + b2wt . B 2 t B 2 t = b2rt . B 2 t + b2wf . B 2 f + b2wt . B 2 t K 1 = kr1 . K 1 + kw1 . K 1 + kw2 . K 2 K 2 = kr2 . K 2 + kw1 . K 1 + kw2 . K 2 4 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

  9. Modelling Mutual Exclusion Algorithms Modelling the Processes in CCS Assumption: P i cannot fail or terminate within critical section Peterson’s algorithm while true do “non-critical section” ; b i := true ; k := j ; while b j ∧ k = j do skip end ; “critical section” ; b i := false ; end 5 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

  10. Modelling Mutual Exclusion Algorithms Modelling the Processes in CCS Assumption: P i cannot fail or terminate within critical section Peterson’s algorithm CCS representation P 1 = b1wt . kw2 . P 11 while true do “non-critical section” ; P 11 = b2rf . P 12 + b i := true ; b2rt . ( kr1 . P 12 + kr2 . P 11 ) k := j ; P 12 = enter1 . exit1 . b1wf . P 1 while b j ∧ k = j do skip end ; P 2 = b2wt . kw1 . P 21 “critical section” ; P 21 = b1rf . P 22 + b i := false ; b1rt . ( kr1 . P 21 + kr2 . P 22 ) end P 22 = enter2 . exit2 . b2wf . P 2 Peterson = ( P 1 � P 2 � B 1 f � B 2 f � K 1 ) \ L for L = { b1rf , b1rt , b1wf , b1wt , b2rf , b2rt , b2wf , b2wt , kr1 , kr2 , kw1 , kw2 } 5 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

  11. Modelling Mutual Exclusion Algorithms Modelling the Processes in CCS Assumption: P i cannot fail or terminate within critical section Peterson’s algorithm CCS representation P 1 = b1wt . kw2 . P 11 while true do “non-critical section” ; P 11 = b2rf . P 12 + b i := true ; b2rt . ( kr1 . P 12 + kr2 . P 11 ) k := j ; P 12 = enter1 . exit1 . b1wf . P 1 while b j ∧ k = j do skip end ; P 2 = b2wt . kw1 . P 21 “critical section” ; P 21 = b1rf . P 22 + b i := false ; b1rt . ( kr1 . P 21 + kr2 . P 22 ) end P 22 = enter2 . exit2 . b2wf . P 2 Peterson = ( P 1 � P 2 � B 1 f � B 2 f � K 1 ) \ L for L = { b1rf , b1rt , b1wf , b1wt , b2rf , b2rt , b2wf , b2wt , kr1 , kr2 , kw1 , kw2 } 5 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

  12. Modelling Mutual Exclusion Algorithms Modelling the Processes in CCS Assumption: P i cannot fail or terminate within critical section Peterson’s algorithm CCS representation P 1 = b1wt . kw2 . P 11 while true do “non-critical section” ; P 11 = b2rf . P 12 + b i := true ; b2rt . ( kr1 . P 12 + kr2 . P 11 ) k := j ; P 12 = enter1 . exit1 . b1wf . P 1 while b j ∧ k = j do skip end ; P 2 = b2wt . kw1 . P 21 “critical section” ; P 21 = b1rf . P 22 + b i := false ; b1rt . ( kr1 . P 21 + kr2 . P 22 ) end P 22 = enter2 . exit2 . b2wf . P 2 Peterson = ( P 1 � P 2 � B 1 f � B 2 f � K 1 ) \ L for L = { b1rf , b1rt , b1wf , b1wt , b2rf , b2rt , b2wf , b2wt , kr1 , kr2 , kw1 , kw2 } 5 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

  13. Modelling Mutual Exclusion Algorithms Modelling the Processes in CCS Assumption: P i cannot fail or terminate within critical section Peterson’s algorithm CCS representation P 1 = b1wt . kw2 . P 11 while true do “non-critical section” ; P 11 = b2rf . P 12 + b i := true ; b2rt . ( kr1 . P 12 + kr2 . P 11 ) k := j ; P 12 = enter1 . exit1 . b1wf . P 1 while b j ∧ k = j do skip end ; P 2 = b2wt . kw1 . P 21 “critical section” ; P 21 = b1rf . P 22 + b i := false ; b1rt . ( kr1 . P 21 + kr2 . P 22 ) end P 22 = enter2 . exit2 . b2wf . P 2 Peterson = ( P 1 � P 2 � B 1 f � B 2 f � K 1 ) \ L for L = { b1rf , b1rt , b1wf , b1wt , b2rf , b2rt , b2wf , b2wt , kr1 , kr2 , kw1 , kw2 } 5 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

  14. Modelling Mutual Exclusion Algorithms Modelling the Processes in CCS Assumption: P i cannot fail or terminate within critical section Peterson’s algorithm CCS representation P 1 = b1wt . kw2 . P 11 while true do “non-critical section” ; P 11 = b2rf . P 12 + b i := true ; b2rt . ( kr1 . P 12 + kr2 . P 11 ) k := j ; P 12 = enter1 . exit1 . b1wf . P 1 while b j ∧ k = j do skip end ; P 2 = b2wt . kw1 . P 21 “critical section” ; P 21 = b1rf . P 22 + b i := false ; b1rt . ( kr1 . P 21 + kr2 . P 22 ) end P 22 = enter2 . exit2 . b2wf . P 2 Peterson = ( P 1 � P 2 � B 1 f � B 2 f � K 1 ) \ L for L = { b1rf , b1rt , b1wf , b1wt , b2rf , b2rt , b2wf , b2wt , kr1 , kr2 , kw1 , kw2 } 5 of 28 Concurrency Theory Winter Semester 2019/20 Lecture 7: Modelling and Analysing Mutual Exclusion Algorithms & Value-Passing CCS

Recommend


More recommend