1 / 12

Introduction to Communicating Sequential Processes (CSP) and Concurrency Concepts

This lecture by Prof. Dr. Bertrand Meyer explores the foundational principles of Communicating Sequential Processes (CSP), originally developed by C.A.R. Hoare in 1978, and influenced by E.W. Dijkstra's concepts. We will discuss CSP's role as a concurrency formalism, showcasing its elegant expression of concurrent situations and its impact on modern programming languages like Occam. Key concepts include process definitions, event engagement, basic CSP syntax, non-deterministic choices, and laws governing concurrency.

toshi
Télécharger la présentation

Introduction to Communicating Sequential Processes (CSP) and Concurrency Concepts

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Concurrent Object-Oriented ProgrammingProf. Dr. Bertrand Meyer Lecture 11: An introduction to CSP

  2. Origin Communicating Sequential Processes: C.A.R. Hoare 1978 paper, based in part on ideas of E.W. Dijkstra (guarded commands, 1978 paper and “A Discipline of Programming” book) Revised with help of S. D. Brooks and A.W. Roscoe 1985 book, revised 2004

  3. CSP purpose • Concurrency formalism • Expresses many concurrent situations elegantly • Influenced design of several concurrent programming languages, in particular Occam (Transputer) • Calculus • Formally specified: laws • Makes it possible to prove properties of systems

  4. Basic notions • Processes engage in events • Example: • BDVM = (coin  coffee  coin  coffee  STOP) • a(BDVM) = {coin, coffee} u

  5. Basic CSP syntax • P ::= • Stop | -- Does not engage in any events • a  P | -- Accepts a, then engages in P • PПP | -- Internal choice • PP | -- External choice • P||P | -- Concurrency • P|||P | -- Interleaving • P \ H | -- Hiding (H: alphabet symbols) • mPf (P) -- Recursion

  6. Some examples • CLOCK = (tick  CLOCK) • This is an abbreviation for • CLOCK = mP(tick  P) • CVM = (in1f  (coffee  CVM)) • = (in1f  coffee  CVM) -- Right-associativity • CHM1 = (in1f  out50rp  out20rp  out20rp  out10rp) • CHM2 = (in1f  out50rp  out50rp) • CHM = CHM1  CHM2

  7. More examples • COPYBIT = (in.0 out.0 COPYBIT  • in.1 out.1 COPYBIT)

  8. More examples • VMC = • (in2f  • ((large  VMC)  • (small  out1f  VMC)) •  • (in1f  • ((small VMC)  • (in1f  large  VMC)) • FOOLCUST = (in2f large  FOOLCUST  • in1f large  FOOLCUST) • FOOLCUST || VMC = • mP(in2f large P  in2f  STOP)

  9. Formal semantics: through traces

  10. Internal non-deterministic choice • CH1F = (in1f  • ((out20rp  out20rp  • out20rp out20rp out20rp  CH1F) • П • (out50rp  out50rp  CH1F)))

  11. Laws of concurrency • P || Q = Q || P • P || (Q || R)) = ((P || Q) || R) • P || STOPaP = STOPaP • (c  P) || (c  Q) = (c  (P || Q)) • (c  P) || (d  Q) = STOP -- If c ≠ d • (x: A  P (x)) || (y: B  Q (y)) = (z: (A  B)  (P (z) || Q (z))

  12. Laws of non-deterministic internal choice • P ПQ = Q ПP • P П (Q ПR) = (P ПQ) ПR • x  (P ПQ) = (x  P) П (x Q) • P || (Q ПR) = (P || Q) П(P || R) • (P || Q) ПR = (P || R) П(Q || R) • The recursion operator is not distributive; consider: • P = mX((a  X) П (b  X)) • Q = (mX(a  X)) П(mX(b  X))

More Related