petri net flavored places
play

Petri Net-Flavored Places An Advanced Transition System for - PowerPoint PPT Presentation

Petri Net-Flavored Places An Advanced Transition System for Distributed Computing in Racket J orgen Brandt 2018-09-29 Software Engineering Petri Nets Visually understandable Defined semantics (properties, invariants, correctness)


  1. Petri Net-Flavored Places An Advanced Transition System for Distributed Computing in Racket J¨ orgen Brandt 2018-09-29

  2. Software Engineering

  3. Petri Nets ◮ Visually understandable ◮ Defined semantics (properties, invariants, correctness) ◮ Complete (can be executed, tested) Storage cookie_box cookie_box cookie_box a cookie_box cookie_box CoinSlot Compartment coin sig sig Signal b coin CashBox

  4. Petri Net Syntax ◮ Passive component: #Ref<0.4.2.1> Place Down

  5. Petri Net Syntax m Down down_busy ◮ Passive component: ( r , m , p ) p Place ◮ Active component: Transition Busy Idle

  6. Petri Net Syntax ◮ Passive component: Place op x f ( x ) ◮ Active component: Request Reply Transition ◮ Environment “High-level interface nets”

  7. Example

  8. Implementation: Cookie Vending Machine Storage cookie_box cookie_box cookie_box a cookie_box cookie_box CoinSlot Compartment coin sig sig Signal b coin CashBox https://github.com/joergen7/pnet

  9. Implementation: Cookie Vending Machine

  10. Implementation: Cookie Vending Machine

  11. Implementation: Cookie Vending Machine

  12. Implementation: Cookie Vending Machine

  13. Implementation: Cookie Vending Machine

  14. Possible Application: Cuneiform

  15. Cuneiform: Motivation ◮ Cuneiform is . . . ◮ Functional programming language ◮ Distributed language ◮ Integration of other languages ◮ Open: ◮ command line tools ◮ R scripts ◮ Python libraries ◮ . . . ◮ General: ◮ Universal model of computation https://cuneiform-lang.org

  16. Cuneiform Code Example: Iteration def f( txt : File ) -> <y : File> in Perl *{ ... }* let xs : [File] = ['a.txt', 'b.txt' : File]; for x <- xs do f( txt = x )|y end ;

  17. Distrubuted Execution Environment: Sequence Diagram c m w 1 w 2 •••• e

  18. Distributed Execution Environment: Sequence Diagram c m w 1 w 2 •••• e a 1 ,..., a 4

  19. Distributed Execution Environment: Sequence Diagram c m w 1 w 2 •••• e a 1 ,..., a 4 a 1 a 2

  20. Distributed Execution Environment: Sequence Diagram c m w 1 w 2 •••• e a 1 ,..., a 4 a 1 a 2 ( a 1 , r 1 )

  21. Distributed Execution Environment: Sequence Diagram c m w 1 w 2 •••• e a 1 ,..., a 4 a 1 a 2 ( a 1 , r 1 ) • ( a 1 , r 1 )

  22. Distributed Execution Environment: Sequence Diagram c m w 1 w 2 •••• e a 1 ,..., a 4 a 1 a 2 ( a 1 , r 1 ) • a 3 ( a 1 , r 1 ) ( a 2 , r 2 ) • ( a 2 , r 2 ) ( a 3 , r 3 ) • ( a 3 , r 3 ) ( a 4 , r 4 ) • ( a 4 , r 4 )

  23. Distributed Execution Environment: Sequence Diagram c m w 1 w 2 •••• e a 1 ,..., a 4 a 1 a 2 ( a 1 , r 1 ) • a 3 ( a 1 , r 1 ) ( a 2 , r 2 ) • ( a 2 , r 2 ) ( a 3 , r 3 ) • ( a 3 , r 3 ) ( a 4 , r 4 ) • v ( a 4 , r 4 )

  24. Distributed Execution Environment: Sequence Diagram c m w 1 w 2 Three interfaces •••• Between . . . e ◮ User and client a 1 ,..., a 4 a 1 a 2 expressions, values ( a 1 , r 1 ) • a 3 ( a 1 , r 1 ) ( a 2 , r 2 ) • ( a 2 , r 2 ) ( a 3 , r 3 ) • ( a 3 , r 3 ) ( a 4 , r 4 ) • v ( a 4 , r 4 )

  25. Distributed Execution Environment: Sequence Diagram c m w 1 w 2 Three interfaces •••• Between . . . e ◮ User and client a 1 ,..., a 4 a 1 a 2 expressions, values ◮ Client and master ( a 1 , r 1 ) • a 3 ( a 1 , r 1 ) ( a 2 , r 2 ) • demand, applications, results ( a 2 , r 2 ) ( a 3 , r 3 ) • ( a 3 , r 3 ) ( a 4 , r 4 ) • v ( a 4 , r 4 )

  26. Distributed Execution Environment: Sequence Diagram c m w 1 w 2 Three interfaces •••• Between . . . e ◮ User and client a 1 ,..., a 4 a 1 a 2 expressions, values ◮ Client and master ( a 1 , r 1 ) • a 3 ( a 1 , r 1 ) ( a 2 , r 2 ) • demand, applications, results ( a 2 , r 2 ) ( a 3 , r 3 ) ◮ Master and worker • ( a 3 , r 3 ) applications, results ( a 4 , r 4 ) • v ( a 4 , r 4 )

  27. Distributed Execution Environment: Petri Net Model c i m w j ◮ The sequence diagram suggests a coarse structure ◮ Composing nets in a distributed system ◮ m independent clients and n independent workers

  28. Distributed Execution Environment: Master (i) m CRE master features ◮ Cache ◮ Scheduler ◮ Fault tolerance ◮ Language-independence

  29. Distributed Execution Environment: Master (ii) ExitClient AddClient q q BadClient ClientPool link_worker n • p q q q link_client AddWorker q remove_client Demand Guard q q q q [] SentDemand p q q recover_demand send_demand A A +[ a ] q • Introduced Allowed schedule (( q , i ), a ) a a a ∉ A a a ( p , a ) CreRequest WorkerRequest introduce allow p ( p , a ) (( q , i ), a ) a lookup ( a , δ ) BusyDemand Cache WorkerPool BusyWorker DemandPool (a, δ ) (( q , i ), a ) ( a , δ ) • p ( p , a ) ( a , δ ) CreReply WorkerResult (( q , i ), a , δ ) ( a , δ ) ( a , δ ) (( p , a ), δ ) release address Released a ( p , a ) • • p n • • reallow cre_master p ExitWorker remove_demand Surplus n • a , δ∈ Expr n ∈ ℕ ,n>0 p r ∈ Result i ∈ℕ remove_worker e ∈ Error p , q ∈ Pid

  30. Cuneiform Application: Variant Calling with GATK https://cuneiform-lang.org

  31. Wrap up

  32. Related Work ◮ CPNTools : Graphical editor with code generation to Erlang ◮ Haskell-colored Petri nets : Functional embeddings

  33. Conclusion ◮ Petri nets as a programming model ◮ Visual interpretation of code ◮ Composition to form distributed systems ◮ Petri net on the inside ◮ Racket place on the outside https://github.com/joergen7/pnet

Recommend


More recommend