http distributedcomponents net ilya sergey james r wilcox
play

` http://distributedcomponents.net Ilya Sergey James R. Wilcox - PowerPoint PPT Presentation

Programming and Proving with Distributed Protocols Disel: Distributed Separation Logic { P } c { Q } ` http://distributedcomponents.net Ilya Sergey James R. Wilcox Zach Tatlock Distributed Systems Distributed Infrastructure Distributed


  1. Programming and Proving with Distributed Protocols Disel: Distributed Separation Logic { P } c { Q } ` http://distributedcomponents.net Ilya Sergey James R. Wilcox Zach Tatlock

  2. Distributed Systems

  3. Distributed Infrastructure

  4. Distributed Applications

  5. Verified Distributed Systems

  6. Verified Distributed Infrastructure

  7. Verified Distributed Infrastructure Veri- Wow -Cert Iron

  8. Verified Distributed Applications

  9. Verified Distributed Applications Veri- Wow -Cert Iron

  10. Verified Distributed Applications Veri- Wow Challenging to verify apps in terms of infra. starting from scratch is unacceptable Indicates deeper problems with composition one node’s client is another’s server! -Cert Iron

  11. Verified Distributed Applications Challenges Client reasoning Veri- Wow Invariants Separation -Cert Iron

  12. Verified Distributed Applications Challenges Solutions Client reasoning Protocols Veri- Wow Invariants rule WithInv Separation rule/Hooks Frame ` { P } c { Q } -Cert Disel: Iron

  13. Outline ` { P } c { Q } Protocols and running example Logical mechanisms programming with protocols invariants framing and hooks Implementation and future work

  14. Cloud Compute C S

  15. Cloud Compute 21 C S

  16. Cloud Compute

  17. Cloud Compute

  18. Cloud Compute : Server while true: (from, n) <- recv Req send Resp(n, factors(n)) to from

  19. Cloud Compute : Server while true: (from, n) <- recv Req send Resp(n, factors(n)) to from Traditional specification: messages from server have correct factors Proved by finding an invariant of the system

  20. Cloud Compute: Server

  21. Cloud Compute: Client

  22. Cloud Compute: Client send Req(21) to server (_, ans) <- recv Resp assert ans == {3, 7}

  23. Cloud Compute: Client send Req(21) to server (_, ans) <- recv Resp assert ans == {3, 7} Start over with clients in system?

  24. Cloud Compute: Client send Req(21) to server (_, ans) <- recv Resp assert ans == {3, 7} Start over with clients in system? In Disel: use protocol to describe client interface

  25. Protocols

  26. Protocols

  27. Protocols A protocol is an interface among nodes

  28. Protocols A protocol is an interface among nodes Enables compositional verification

  29. Cloud Compute Protocol Messages:

  30. Cloud Compute Protocol Messages: State:

  31. Cloud Compute Protocol Messages: State: Transitions:

  32. Cloud Compute Protocol Messages: State: Transitions: Sends: precondition and effect

  33. Cloud Compute Protocol Messages: State: Transitions: Sends: precondition and effect Receives: effect

  34. Cloud Compute Protocol Messages: State: Transitions: Sends: Receives:

  35. Cloud Compute Protocol Messages: Req(n) | Resp(n,s) State: Transitions: Sends: Receives:

  36. Cloud Compute Protocol Messages: Req(n) | Resp(n,s) outstanding: Set<Msg> State: Transitions: Sends: Receives:

  37. Cloud Compute Protocol Messages: Req(n) | Resp(n,s) outstanding: Set<Msg> State: Transitions: Req Resp Sends: Receives: Req Resp

  38. Cloud Compute Req(21) C S Send Req(n) Precondition: none Effect: none

  39. Cloud Compute Req(21) ( C ,21) { } C S Receive Req(n) add (from, n) to out Effect:

  40. Cloud Compute { } C S Resp({3,7}) Send Resp(n,l) l == factors(n) Requires: (n,to) in out removes (n,to) from out Effect:

  41. Cloud Compute { } C S Resp({3,7}) Recv Resp(n,l) Effect: none

  42. Cloud Compute Protocol Messages: Req(n) | Resp(n,s) outstanding: Set<Msg> State: Transitions: Req Resp Sends: Receives: Req Resp

  43. Outline ` { P } c { Q } Protocols and running example Logical mechanisms programming with protocols invariants framing and hooks Implementation and future work

  44. Cloud Compute : Server while true: (from, n) <- recv Req send Resp(n, factors(n)) to from

  45. Cloud Compute : Server while true: (from, n) <- recv Req send Resp(n, factors(n)) to from Precondition on send requires correct factors

  46. Cloud Compute: Server { Pre } ` { } m h send m to h ( ) sent t t , while true: (from, n) <- recv Req send Resp(n, factors(n)) to from Precondition on send requires correct factors

  47. Cloud Compute: Server { Pre } ` { } m h send m to h ( ) sent t t t , while true: (from, n) <- recv Req send Resp(n, factors(n)) to from Precondition on send requires correct factors

  48. Cloud Compute: Server t ∈ { Pre } ` { } m h send m to h ( ) sent t t t , while true: (from, n) <- recv Req send Resp(n, factors(n)) to from Precondition on send requires correct factors

  49. Cloud Compute: Server t ∈ { Pre } ` { } m h send m to h ( ) sent t t t , while true: (from, n) <- recv Req send Resp(n, factors(n)) to from Precondition on send requires correct factors

  50. Cloud Compute: Server t ∈ { Pre } ` { } m h send m to h ( ) sent t t t , while true: (from, n) <- recv Req send Resp(n, factors(n)) to from Precondition on send requires correct factors

  51. Cloud Compute: Client send Req(21) to server (_, ans) <- recv Resp assert ans == {3, 7}

  52. Cloud Compute: Client send Req(21) to server (_, ans) <- recv Resp assert ans == {3, 7} recv doesn’t ensure correct factors

  53. Cloud Compute: Client send Req(21) to server (_, ans) <- recv Resp assert ans == {3, 7} recv doesn’t ensure correct factors

  54. Cloud Compute: Client t ∈ ` { > } m { recvd ( ) } recv m t send Req(21) to server (_, ans) <- recv Resp assert ans == {3, 7} recv doesn’t ensure correct factors

  55. Protocol Invariants ` { P } c { Q } I inductive 0 ` { P ∧ I } c { Q ∧ I }

  56. Protocol Invariants ` { P } c { Q } I inductive 0 ` { P ∧ I } c { Q ∧ I } Protocol where every state satisfies I

  57. Cloud Compute: Client t ∈ 0 ` { > } m { recvd ( ) } recv m t send Req(21) to server (_, ans) <- recv Resp assert ans == {3, 7} Now recv ensures correct factors

  58. Cloud Compute: More Clients send Req(21) to server 1 send Req(35) to server 2 (_, ans 1 ) <- recv Resp (_, ans 2 ) <- recv Resp assert ans 1 ans 2 == {3, 5, 7} ∪

  59. Cloud Compute: More Clients send Req(21) to server 1 send Req(35) to server 2 (_, ans 1 ) <- recv Resp (_, ans 2 ) <- recv Resp assert ans 1 ans 2 == {3, 5, 7} ∪ Same protocol enables verification

  60. Frame rule ` { P } c { Q } R stable ` { P R } c { Q R } ∗ ∗

  61. Frame rule ` { P } c { Q } R stable ` { P R } c { Q R } ∗ ∗ Reuse invariants from component protocols

  62. Frame rule ` { P } c { Q } R stable independent protocols ` { P R } c { Q R } ∗ ∗ Reuse invariants from component protocols

  63. Frame rule: Hooks ` { P } c { Q } R stable ` { P R } c { Q R } ∗ ∗

  64. Frame rule: Hooks ` { P } c { Q } R stable ` { P R } c { Q R } ∗ ∗ Allows one protocol to restrict another

  65. Outline ` { P } c { Q } Protocols and running example Logical mechanisms programming with protocols invariants framing and hooks Implementation and future work

  66. Implementation Shallowly embedded in Coq with full power of functional programming Executable via extraction to OCaml via trusted shim to implement semantics Case study: two-phase commit exercises all features of the logic

  67. Related and Future Work Concurrent separation logics Iris, FCSL, CAP, … Adding other effects e.g. mutable heap, threads, failure…

  68. Composition: A way to make proofs harder

  69. Composition: A way to make proofs harder “In 1997, the unfortunate reality is that engineers rarely specify and reason formally about the systems they build. It seems unlikely that reasoning about the composition of open-system specifications will be a practical concern within the next 15 years.”

  70. Verified Distributed Applications Challenges Solutions Client reasoning Protocols Veri- Wow Invariants rule WithInv Separation rule/Hooks Frame ` { P } c { Q } -Cert Disel: Iron

Recommend


More recommend