cashew nuts in haskell
play

Cashew-Nuts in Haskell Implementation of a Timed Process Calculus - PowerPoint PPT Presentation

Cashew-Nuts in Haskell Implementation of a Timed Process Calculus Simon Foster University of Sheffield November 25, 2005 Simon Foster (University of Sheffield) Cashew-Nuts in Haskell November 25, 2005 1 / 75 Outline 1 Introduction Overview


  1. Cashew-Nuts in Haskell Implementation of a Timed Process Calculus Simon Foster University of Sheffield November 25, 2005 Simon Foster (University of Sheffield) Cashew-Nuts in Haskell November 25, 2005 1 / 75

  2. Outline 1 Introduction Overview of Cashew-Nuts Features 2 Implementation Syntax Operational Semantics Labelled Transition Systems 3 Message Passing Scoping Implementation 4 Type System Background Making it work 5 ConCalc 6 Conclusion Simon Foster (University of Sheffield) Cashew-Nuts in Haskell November 25, 2005 2 / 75

  3. Introduction Overview of Cashew-Nuts Outline 1 Introduction Overview of Cashew-Nuts Features 2 Implementation Syntax Operational Semantics Labelled Transition Systems 3 Message Passing Scoping Implementation 4 Type System Background Making it work 5 ConCalc 6 Conclusion Simon Foster (University of Sheffield) Cashew-Nuts in Haskell November 25, 2005 3 / 75

  4. Introduction Overview of Cashew-Nuts What is Cashew-Nuts? A process calculus based on CCS. Extended with the notion of time, facilitated by multiple abstract clocks . Clocks facilitate multi-party sychronization : instantaneous, undirected and simultaneous synchronizations between an unbounded number of processes. Clocks can either be deterministic and maximal-progress respecting, or non-deterministic and violating maximal-progress. The latest in the timed process calculus family TPL , CSA , PMC and CaSE . Simon Foster (University of Sheffield) Cashew-Nuts in Haskell November 25, 2005 4 / 75

  5. Introduction Overview of Cashew-Nuts Time vs Mobility Ongoing discussion of the relative merits of time and mobility. Time is better suited to situations when an unspecified number of processes must synchronize simultaneously. π is better suited to systems which are not finite state, such as a complex client/server interface and data-types. The two primary uses of Cashew-Nuts/CaSE are based around finite state systems (i.e. Digital Signal Processing and workflow orchestration). For example the split-join pattern needs a method of resynchronizing all participating sub-workflows. π calculus very complicated to implement. Expect a mobile timed calculus at some point though. Simon Foster (University of Sheffield) Cashew-Nuts in Haskell November 25, 2005 5 / 75

  6. Introduction Overview of Cashew-Nuts Cashew-Nuts Syntax Definition E ::= 0 | ∇ | ∆ | ∆ σ | α. E | ⌊ ⌊E⌋ ⌋ σ ( E ) | ⌈ ⌈E⌉ ⌉ σ ( E ) | E + E | E|E | E [ a �→ b ] | E \ a | E /σ | E / /σ | µ X . E | X α and β are action labels, possibly τ (the silent action). a and b are action labels, excluding τ . σ and ρ are clock labels within the clock universe. Simon Foster (University of Sheffield) Cashew-Nuts in Haskell November 25, 2005 6 / 75

  7. Introduction Features Outline 1 Introduction Overview of Cashew-Nuts Features 2 Implementation Syntax Operational Semantics Labelled Transition Systems 3 Message Passing Scoping Implementation 4 Type System Background Making it work 5 ConCalc 6 Conclusion Simon Foster (University of Sheffield) Cashew-Nuts in Haskell November 25, 2005 7 / 75

  8. Introduction Features Synchronization As in CCS, if two complementary actions can fire at the same time on different sides of a parallel composition, a synchronization can happen, resulting in a silent action being emitted. τ a . P | a . Q → P | Q Simon Foster (University of Sheffield) Cashew-Nuts in Haskell November 25, 2005 8 / 75

  9. Introduction Features Time-outs σ 1 ⌊ P ⌋ σ ( Q ) − → Q Key to the use of time in processes is the timeout operator, similar to that present in TPL but with addition of a parameter specifying which clock the timeout relates to. Timeout allows a process to choose between 2 different routes depending on whether a specific clock can tick or not. All operators except ∆, ∆ σ and τ (except in the case of non-determinism and in contrast to PMC) are patient, that is to say they will allow a clock to tick. Thus the process a . P has an implicit self-transition for every clock in the clock-sort. Simon Foster (University of Sheffield) Cashew-Nuts in Haskell November 25, 2005 9 / 75

  10. Introduction Features Time-outs (cont.) σ � a a σ . P → P Actions can be be made insistent (i.e. not allowing ticks) by summing them with a ∆ or ∆ σ , i.e. a . P + ∆ or a . P + ∆ σ , which we write as a . P and a σ . P respectively. Cashew-Nuts has two timeout operators Fragile, which may be interrupted by another clock ticking on the LHS. Stable, which cannot be removed by another clock ticking (instead causing the LHS to advance). ρ 1 → P ′ ⌊ P ⌋ σ ( Q ) − ρ 1 ⌈ P ⌉ σ ( Q ) − → ⌈ P ′ ⌉ σ ( Q ) Simon Foster (University of Sheffield) Cashew-Nuts in Haskell November 25, 2005 10 / 75

  11. Introduction Features Maximal Progress States that silent actions always take precedence over clock ticks. Allows detection of internal activity (or the lack thereof) within a process. Inherited from Hennessy’s TPL . In Cashew-Nuts all clock actions (ticks) are annotated with either a 1 or 0 index, indicating whether they are respecting determinism and maximal progress or not. Sometimes known as red and black ticks. a . P | a . Q σ 1 � a . P | a . Q σ 0 → a . P | a . Q Simon Foster (University of Sheffield) Cashew-Nuts in Haskell November 25, 2005 11 / 75

  12. Introduction Features Clock Hiding As actions in CCS can be restricted , clocks in Cashew-Nuts (and indeed CaSE) can be hidden . Unlike restriction, clock hiding does not remove possible actions, but instead converts ticks to silent actions (which is somewhat similar to hiding in CSP). This forms the idea of hiearchy, since if a hidden clock can tick at the top of a hierarchy of processes, the resulting τ s will result in other clocks further down the hiearchy being blocked by maximal progress. τ ⌊ P ⌋ σ ( Q ) /σ − → Q Simon Foster (University of Sheffield) Cashew-Nuts in Haskell November 25, 2005 12 / 75

  13. Introduction Features Non-deterministic time Hennessy’s TPL stated that if a clock tick σ from a process P resulted in two processes Q and R , Q ≡ R CSA and CaSE also had this restriction, but Cashew-Nuts removes it. Instead ticks are characterised by a 1 or 0 subscript, which define whether a tick is deterministic and maximal-progress respecting or not (respectively). Thus where CaSE included a single clock hiding operator, Cashew-Nuts has 2 Single hiding, P /σ which converts only deterministic (i.e. subscript 1) ticks. Double hiding, P / /σ , which converts both types of ticks (thus resulting in 2 τ s). Simon Foster (University of Sheffield) Cashew-Nuts in Haskell November 25, 2005 13 / 75

  14. Introduction Features Non-deterministic time (cont.) Similarly, whereas in CaSE there existed just one of each type of timeout operator, in Cashew-Nuts there are 2 Non-deterministic time-out, i.e. ⌊ ⌊ P ⌋ ⌋ σ ( Q ) and ⌈ ⌈ P ⌉ ⌉ σ ( Q ), in which a σ can occur on either side, a tick on the LHS being indicated by a σ 0 . Deterministic time-out, which is derived from the above, simply blocking σ ticks on the LHS. Definition def ⌊ P ⌋ σ ( Q ) = ⌊ ⌊ P + ∆ σ ⌋ ⌋ σ ( Q ) def ⌈ P ⌉ σ ( Q ) = ⌈ ⌈ P + ∆ σ ⌉ ⌉ σ ( Q ) Simon Foster (University of Sheffield) Cashew-Nuts in Haskell November 25, 2005 14 / 75

  15. Introduction Features Non-deterministic time (cont.) Non-deterministic ticks cause deterministic ticks to be demoted, so that if P σ 1 → P ′ and Q σ 0 → Q ′ then Q | P σ 0 → Q ′ | P ′ Thus Cashew-Nuts also includes a “weak” version of ∆, which only prevents deterministic ticks: the ∇ process. This can only perform σ 0 ticks and thus all surrounding ticks are demoted in its presence. Simon Foster (University of Sheffield) Cashew-Nuts in Haskell November 25, 2005 15 / 75

  16. Implementation Implementation in Haskell Haskell is a purely functional programming language. It has been used to implement the Cashew-Nuts process calculus since, as shall be demonstrated, it naturally represents the syntax. Large derived syntax can be represented elegantly via functions. Original version developed by Barry Norton for CaSE, and then enhanced by Andrew Hughes and Simon Foster for the CASheW-s (now Cashew) Darwin Project. My work has been to add bisimulation semantics and make it realistic for implementation of the Cashew workflow semantics. Simon Foster (University of Sheffield) Cashew-Nuts in Haskell November 25, 2005 16 / 75

  17. Implementation Syntax Outline 1 Introduction Overview of Cashew-Nuts Features 2 Implementation Syntax Operational Semantics Labelled Transition Systems 3 Message Passing Scoping Implementation 4 Type System Background Making it work 5 ConCalc 6 Conclusion Simon Foster (University of Sheffield) Cashew-Nuts in Haskell November 25, 2005 17 / 75

  18. Implementation Syntax Syntax in Haskell We use parametric polymorphism to introduce the action, clock and process label sets, as well as for providing process bindings. Definition data Process a c p h v m = · · · a, c, and p are types representing action, clock and process labels respectively. h is the type of Action Headers (defined later). v is the type of (message) value that will be passed between processes. m is the type of Monad the process’s bindings will be executed in. Simon Foster (University of Sheffield) Cashew-Nuts in Haskell November 25, 2005 18 / 75

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend