Choreographies


Concurrency is hard

Shared-memory concurrency is ridiculously hard

+ concurrency?

Choreographies


Message passing concurrency

Choreographies are a way of describing communicating systems as global programs

A

πŸ’ƒ

B

πŸ•ΊπŸ½

A

πŸ’ƒ

B

πŸ•ΊπŸ½

        A.x -> B.x
      

        A.x -> B.x
      

A


        Send("B",x)
      

B


        x = Receive("A")
      

        A.x -> B.x
        let y@A = foo()
        let w@B = bar()
      

A


        Send("B",x)
        y = foo()
      

B


        x = Receive("A")
        w = bar()
      

        A.x -> B.x
        let y@A = foo()
        let w@B = bar()
      

        A.x -> B.x
        let y@A = foo()
        let w@B = bar()
        if y@A
          A->B[T]
          ...
        else
          A->B[F]
          ...
      

        A.x -> B.x
        let y@A = crunch()
        let w@B = crunch()
        if y@A
          A->B[T]
          ...
        else
          A->B[F]
          ...
      

A


        if y
          Choose("B",T)
          ...
        else
          Choose("B",F)
          ...
      

B


        if Choice("A")
          ...
        else
          ...
      

+ concurrency?


        A.x -> B.x
        B.y -> C.y
        ...
      


      A.x -> B.x
      B.y -> C.y
      ...
    

A
B
C

Deadlock-freedom

Communication


A.x -> B.y;C

Communication


S
A.x -> B.y;C

Communication


S(A,x) = d
A.x -> B.y;C

Communication


A.x -> B.y;C
S[(B,y)|->d]

Communication


S[(B,y)|->d]
C

        A.x -> B.x
        B.y -> C.y
        ...
      


        A.x -> B.x
        B.y -> C.y
        ...
      

EPN

EPN

Selection

Payload

Closure

?