demo presentation chor
TRANSCRIPT
![Page 2: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/2.jpg)
Background and Motivations
![Page 3: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/3.jpg)
● Distributed system: a network of endpoints that communicate by exchanging messages.
● Widespread! Let's see some examples...
Distributed Systems
![Page 4: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/4.jpg)
● The Internet is a distributed system:
The Internet
![Page 5: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/5.jpg)
= Endpoint
● The Internet is a distributed system:
The Internet
![Page 6: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/6.jpg)
OS
● The OS and apps in your computer (or phone):
Your Computer
![Page 7: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/7.jpg)
● Even applications can be distributed systems. Google Chrome:
Tab Manager
Your browser
![Page 8: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/8.jpg)
Distributed systems are big!
System Number of endpoints
My computer 160
A house Hundreds
A company Thousands (or millions)
The Internet At least 20 billions
![Page 9: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/9.jpg)
● How do we program all these endpoints?
● We write a program for each.
● Programs interact by sending and receiving messages.
Endpoint Programming
![Page 10: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/10.jpg)
● Alice wants to know the price of a book from Amazon.
send “rabbits” to Amazon
recv price from Amazon
Alicerecv book from Alice
send price(book) to Alice
Amazon
Endpoint Programming: example
![Page 11: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/11.jpg)
● Endpoint programming is error-prone.
Deadlocks
![Page 12: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/12.jpg)
● Endpoint programming is error-prone.
send “rabbits” to Amazon
recv price from Amazon
Alicerecv book from Alice
send price(book) to Alice
Amazon
Deadlocks
![Page 13: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/13.jpg)
● Endpoint programming is error-prone.
send “rabbits” to Amazon
recv price from Amazon
Alicerecv book from Alice
send price(book) to Alice
Amazon
Deadlocks
![Page 14: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/14.jpg)
● Endpoint programming is error-prone.
send “rabbits” to Amazon
recv price from Amazon
Alicerecv book from Alice
send price(book) to Alice
Amazon
Deadlocks
![Page 15: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/15.jpg)
● Endpoint programming is error-prone.
● Mismatching of input/output actions leads to a deadlock.
recv price from Amazon
send “rabbits” to Amazon
Alicerecv book from Alice
send price(book) to Alice
Amazon
Deadlocks
![Page 16: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/16.jpg)
● Endpoint programming is error-prone.
● Mismatching of input/output actions leads to a deadlock.
recv price from Amazon
send “rabbits” to Amazon
Alicerecv book from Alice
send price(book) to Alice
Amazon
Deadlocks
● Creating deadlocks is easy.
● Detecting deadlocks is hard [Kobayashi, 06].
![Page 17: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/17.jpg)
● Therac-25: a machine for radiation therapy in the 80s.
● Unsafe communications caused excessive amounts of radiation (100x).
● At least 6 accidents, 3 deaths.
Famous bugs
![Page 18: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/18.jpg)
● 2003: Blackout in Northeast America.
● Started from a communication bug in a monitoring station.
● Affected 55 million people.
● 11 deaths.
● At least 7 billion USD lost.
Famous bugs
![Page 19: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/19.jpg)
● In general, we would like systems to be safe.
● Safe = no bugs given by wrong sending/receiving actions.
Safety
![Page 20: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/20.jpg)
● Human error.
How does it happen?
![Page 21: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/21.jpg)
● Human error.
● More quality control?
How does it happen?
![Page 22: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/22.jpg)
recv price from Amazonsend “rabbits” to Amazon
Alice Amazonrecv book from Alicesend price(book) to Alice
Checking for bugs
![Page 23: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/23.jpg)
recv price from Amazonsend “rabbits” to Amazon
Alice Amazonrecv book from Alicesend price(book) to Alice
Ah-ha! A deadlock!That was easy!
Checking for bugs
![Page 24: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/24.jpg)
Alice
Amazon
recv book from Alicesend price(book) to Alicerecv price(book) from Charliesend text(book) to Charlie
Charlie
recv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alice
Alice
send “rabbits” to Amazonrecv price from Amazonsend price to Bobrecv address from Charlierecv text from Bob
Bob
recv price from Alicerecv text from Charliesend text to Alice
...
Checking for bugs
![Page 25: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/25.jpg)
Alice
send “rabbits” to Amazonrecv price from Amazonsend price to Bobrecv address from Charlierecv text from Bobsend “horses” to Amazonrecv price2 from Amazonsend “spiders” to Amazonsend price3 to Bobrecv address1 from Charlierecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv text2 from Bobrecv price from Amazonsend price to Bobrecv address from Charlierecv text from Bob
recv price from Alicerecv text from Charlierecv price from Alicerecv text from Charliesend text to Alicesend text to Alicerecv price from Alicesend money(price) to Amazonrecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv text from Amazonsend address to Alicerecv price from Alicerecv price from Alicerecv text from Charliesend text to Alicerecv text from Charliesend text to Alice
recv book from Alicesend price(book) to Alicerecv price(book) from Charlierecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv price from Alicerecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicesend text(book) to Charlie
recv price from Alicesend money(price) to Amazonrecv text from Amazonrecv price from Alicerecv price from Alicesend money(price) to Amazonrecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv text from Amazonsend address to Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicesend address to Alice
send “rabbits” to Amazonrecv price from Amazonsend price to Bobrecv address from Charlierecv text from Bobsend “horses” to Amazonrecv price2 from Amazonsend “spiders” to Amazonsend price3 to Bobrecv address1 from Charlierecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alice
Checking for bugs
![Page 26: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/26.jpg)
Alice
send “rabbits” to Amazonrecv price from Amazonsend price to Bobrecv address from Charlierecv text from Bobsend “horses” to Amazonrecv price2 from Amazonsend “spiders” to Amazonsend price3 to Bobrecv address1 from Charlierecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv text2 from Bobrecv price from Amazonsend price to Bobrecv address from Charlierecv text from Bob
recv price from Alicerecv text from Charlierecv price from Alicerecv text from Charliesend text to Alicesend text to Alicerecv price from Alicesend money(price) to Amazonrecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv text from Amazonsend address to Alicerecv price from Alicerecv price from Alicerecv text from Charliesend text to Alicerecv text from Charliesend text to Alice
recv book from Alicesend price(book) to Alicerecv price(book) from Charlierecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv price from Alicerecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicesend text(book) to Charlie
recv price from Alicesend money(price) to Amazonrecv text from Amazonrecv price from Alicerecv price from Alicesend money(price) to Amazonrecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv text from Amazonsend address to Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicesend address to Alice
send “rabbits” to Amazonrecv price from Amazonsend price to Bobrecv address from Charlierecv text from Bobsend “horses” to Amazonrecv price2 from Amazonsend “spiders” to Amazonsend price3 to Bobrecv address1 from Charlierecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alice
send “rabbits” to Amazonrecv price from Amazonsend price to Bobrecv address from Charlierecv text from Bobsend “horses” to Amazonrecv price2 from Amazonsend “spiders” to Amazonsend price3 to Bobrecv address1 from Charlierecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv text2 from Bobrecv price from Amazonsend price to Bobrecv address from Charlierecv text from Bob
recv price from Alicerecv text from Charlierecv price from Alicerecv text from Charliesend text to Alicesend text to Alicerecv price from Alicesend money(price) to Amazonrecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv text from Amazonsend address to Alicerecv price from Alicerecv price from Alicerecv text from Charliesend text to Alicerecv text from Charliesend text to Alice
recv book from Alicesend price(book) to Alicerecv price(book) from Charlierecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv price from Alicerecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicesend text(book) to Charlie
recv price from Alicesend money(price) to Amazonrecv text from Amazonrecv price from Alicerecv price from Alicesend money(price) to Amazonrecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv text from Amazonsend address to Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicesend address to Alice
send “rabbits” to Amazonrecv price from Amazonsend price to Bobrecv address from Charlierecv text from Bobsend “horses” to Amazonrecv price2 from Amazonsend “spiders” to Amazonsend price3 to Bobrecv address1 from Charlierecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alice
send “rabbits” to Amazonrecv price from Amazonsend price to Bobrecv address from Charlierecv text from Bobsend “horses” to Amazonrecv price2 from Amazonsend “spiders” to Amazonsend price3 to Bobrecv address1 from Charlierecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv text2 from Bobrecv price from Amazonsend price to Bobrecv address from Charlierecv text from Bob
recv price from Alicerecv text from Charlierecv price from Alicerecv text from Charliesend text to Alicesend text to Alicerecv price from Alicesend money(price) to Amazonrecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv text from Amazonsend address to Alicerecv price from Alicerecv price from Alicerecv text from Charliesend text to Alicerecv text from Charliesend text to Alice
recv book from Alicesend price(book) to Alicerecv price(book) from Charlierecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv price from Alicerecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicesend text(book) to Charlie
recv price from Alicesend money(price) to Amazonrecv text from Amazonrecv price from Alicerecv price from Alicesend money(price) to Amazonrecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv text from Amazonsend address to Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicesend address to Alice
send “rabbits” to Amazonrecv price from Amazonsend price to Bobrecv address from Charlierecv text from Bobsend “horses” to Amazonrecv price2 from Amazonsend “spiders” to Amazonsend price3 to Bobrecv address1 from Charlierecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alice
send “rabbits” to Amazonrecv price from Amazonsend price to Bobrecv address from Charlierecv text from Bobsend “horses” to Amazonrecv price2 from Amazonsend “spiders” to Amazonsend price3 to Bobrecv address1 from Charlierecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv text2 from Bobrecv price from Amazonsend price to Bobrecv address from Charlierecv text from Bob
recv price from Alicerecv text from Charlierecv price from Alicerecv text from Charliesend text to Alicesend text to Alicerecv price from Alicesend money(price) to Amazonrecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv text from Amazonsend address to Alicerecv price from Alicerecv price from Alicerecv text from Charliesend text to Alicerecv text from Charliesend text to Alice
recv book from Alicesend price(book) to Alicerecv price(book) from Charlierecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv price from Alicerecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicesend text(book) to Charlie
recv price from Alicesend money(price) to Amazonrecv text from Amazonrecv price from Alicerecv price from Alicesend money(price) to Amazonrecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv text from Amazonsend address to Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicesend address to Alice
send “rabbits” to Amazonrecv price from Amazonsend price to Bobrecv address from Charlierecv text from Bobsend “horses” to Amazonrecv price2 from Amazonsend “spiders” to Amazonsend price3 to Bobrecv address1 from Charlierecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alice
send “rabbits” to Amazonrecv price from Amazonsend price to Bobrecv address from Charlierecv text from Bobsend “horses” to Amazonrecv price2 from Amazonsend “spiders” to Amazonsend price3 to Bobrecv address1 from Charlierecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv text2 from Bobrecv price from Amazonsend price to Bobrecv address from Charlierecv text from Bob
recv price from Alicerecv text from Charlierecv price from Alicerecv text from Charliesend text to Alicesend text to Alicerecv price from Alicesend money(price) to Amazonrecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv text from Amazonsend address to Alicerecv price from Alicerecv price from Alicerecv text from Charliesend text to Alicerecv text from Charliesend text to Alice
recv book from Alicesend price(book) to Alicerecv price(book) from Charlierecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv price from Alicerecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicesend text(book) to Charlie
recv price from Alicesend money(price) to Amazonrecv text from Amazonrecv price from Alicerecv price from Alicesend money(price) to Amazonrecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv text from Amazonsend address to Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicesend address to Alice
send “rabbits” to Amazonrecv price from Amazonsend price to Bobrecv address from Charlierecv text from Bobsend “horses” to Amazonrecv price2 from Amazonsend “spiders” to Amazonsend price3 to Bobrecv address1 from Charlierecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alicerecv price from Alicesend money(price) to Amazonrecv text from Amazonsend address to Alice
Checking for bugs
![Page 27: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/27.jpg)
● Avoiding distributed bugs, like deadlocks, is hard [Kobayashi, 06].
● We need tools to deal with this.
Distributed bugs are hard to spot!
![Page 28: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/28.jpg)
Problem
Developing safe distributed systems by programmingendpoints separately is error-prone.
![Page 29: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/29.jpg)
Choreographic Programming: the idea
![Page 30: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/30.jpg)
Choreography
● A single program for defining the behaviour of many endpoints[W3C, 05]
● Our previous example as a choreography:
alice.”rabbits” → amazon.book ;amazon.price(book) → alice.price
![Page 31: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/31.jpg)
Choreography
● A single program for defining the behaviour of many endpoints[W3C, 05]
● Our previous example as a choreography:
alice.”rabbits” → amazon.book ;amazon.price(book) → alice.price
![Page 32: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/32.jpg)
Choreography
● A single program for defining the behaviour of many endpoints[W3C, 05]
● Our previous example as a choreography:
alice.”rabbits” → amazon.book ;amazon.price(book) → alice.price
![Page 33: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/33.jpg)
Choreography
● A single program for defining the behaviour of many endpoints[W3C, 05]
● Our previous example as a choreography:
alice.”rabbits” → amazon.book ;amazon.price(book) → alice.price
● Defines what communications we want to happen, rather thanhow to implement them.
![Page 34: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/34.jpg)
Choreographic Programming
● [Mendling and Hafner, 05] [Qiu et al., 07][Carbone et al., 07] [Lanese et al., 08] ...
![Page 35: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/35.jpg)
Choreographic Programming
● Write a choreography.
Choreography
![Page 36: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/36.jpg)
Choreographic Programming
● Write a choreography.
● Compile it to an executable distributed implementation.
Choreography
Endpoint code
P1
Endpoint code
Pn...
Compiler (Projection)
![Page 37: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/37.jpg)
Example of projection
alice.”rabbits” → amazon.book ;amazon.price(book) → alice.price
![Page 38: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/38.jpg)
Example of projection
alice.”rabbits” → amazon.book ;amazon.price(book) → alice.price
alice amazon
Compiler
![Page 39: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/39.jpg)
Example of projection
alice.”rabbits” → amazon.book ;amazon.price(book) → alice.price
alice amazon
Compiler
send “rabbits” to Amazonrecv price from Amazon
recv book from Alicesend price(book) to Alice
![Page 40: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/40.jpg)
Example of projection
alice.”rabbits” → amazon.book ;amazon.price(book) → alice.price
alice amazon
Compiler
send “rabbits” to Amazonrecv price from Amazon
recv book from Alicesend price(book) to Alice
![Page 41: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/41.jpg)
Example of projection
alice.”rabbits” → amazon.book ;amazon.price(book) → alice.price
alice amazon
Compiler
send “rabbits” to Amazonrecv price from Amazon
recv book from Alicesend price(book) to Alice
![Page 42: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/42.jpg)
● Correct pairing of I/O actions prevents deadlocks!
● Promising approach.
● Instead of detecting deadlocks after programming, prevent deadlocksfrom being written.
Correct by construction!
![Page 43: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/43.jpg)
● Great momentum: there are lots of choreography models out there.
[Busi et al., 05] [Busi et al., 06] [Qiu et al., 07] [Bravetti and Zavattaro, 07][Carbone et al., 07] [Lanese et al., 08] [Basu et al., 11] [Dalla Preda et al., 14]…
● Bisimulation, session types, web services, adaptability, …
The momentum of choreographies
![Page 44: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/44.jpg)
● Dawn of a new paradigm?
The momentum of choreographies
High level
Low level Assembly EndpointProgramming
C, Java, ML, ...
Sequentialprogramming
Distributedprogramming
Compiler
![Page 45: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/45.jpg)
● Dawn of a new paradigm?
The momentum of choreographies
High level
Low level Assembly EndpointProgramming
ChoreographiesC, Java, ML, ...
Sequentialprogramming
Distributedprogramming
Compiler Compiler
![Page 46: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/46.jpg)
● Lots of promising formal models.
● We need tools to evaluate the paradigm.
Towards a new paradigm
![Page 47: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/47.jpg)
Methodology
![Page 48: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/48.jpg)
● We present the Chor language:
● A programming language based on choreographies.
● Eclipse-based IDE with on-the-fly deadlock verification.
● A compiler for generating executable Jolie code.
● An initial evaluation of the choreographic programming paradigm.
In this work
![Page 49: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/49.jpg)
Protocols(specifications)
Choreography(implementation)
C
Verification
Endpoint code
P1
Endpoint code
Pn...
Compiler
Development methodology
![Page 50: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/50.jpg)
● We describe the behaviour of processes in a system.
● Each process has a local state.
● Processes take part to multiparty conversations, tracked as sessions.
● Sessions are started through public channels (e.g., URLs).
● Both sessions and processes can be dynamically created.
Main design ideas
![Page 51: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/51.jpg)
● Alice and Bob buy together a book on Amazon.
An example
![Page 52: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/52.jpg)
Protocol
Choreography
An example
![Page 53: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/53.jpg)
Buyer → Seller : string; // Ask the priceSeller → Buyer : int; // Get the priceBuyer → Helper : int; // ContributionHelper → Seller : { // Choice
ok: Seller → Helper: string;end,
ko: end}
● A protocol for buying a book.
Buyer-Helper-Seller protocol
![Page 54: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/54.jpg)
Buyer → Seller : string; // Ask the priceSeller → Buyer : int; // Get the priceBuyer → Helper : int; // ContributionHelper → Seller : { // Choice
ok: Seller → Helper: string;end,
ko: end}
● A protocol for buying a book.
Buyer-Helper-Seller protocol
![Page 55: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/55.jpg)
Buyer → Seller : string; // Ask the priceSeller → Buyer : int; // Get the priceBuyer → Helper : int; // ContributionHelper → Seller : { // Choice
ok: Seller → Helper: string;end,
ko: end}
● A protocol for buying a book.
Buyer-Helper-Seller protocol
![Page 56: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/56.jpg)
Buyer → Seller : string; // Ask the priceSeller → Buyer : int; // Get the priceBuyer → Helper : int; // ContributionHelper → Seller : { // Choice
ok: Seller → Helper: string;end,
ko: end}
● A protocol for buying a book.
Buyer-Helper-Seller protocol
![Page 57: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/57.jpg)
Buyer → Seller : string; // Ask the priceSeller → Buyer : int; // Get the priceBuyer → Helper : int; // ContributionHelper → Seller : { // Choice
ok: Seller → Helper: string;end,
ko: end}
● A protocol for buying a book.
Buyer-Helper-Seller protocol
![Page 58: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/58.jpg)
Buyer → Seller : string; // Ask the priceSeller → Buyer : int; // Get the priceBuyer → Helper : int; // ContributionHelper → Seller : { // Choice
ok: Seller → Helper: string;end,
ko: end}
● A protocol for buying a book.
Buyer-Helper-Seller protocol
![Page 59: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/59.jpg)
Buyer → Seller : string; // Ask the priceSeller → Buyer : int; // Get the priceBuyer → Helper : int; // ContributionHelper → Seller : { // Choice
ok: Seller → Helper: string;end,
ko: end}
● A protocol for buying a book.
Buyer-Helper-Seller protocol
![Page 60: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/60.jpg)
Protocol
Choreography
![Page 61: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/61.jpg)
Buyer → Seller : string; // Ask the priceSeller → Buyer : int; // Get the priceBuyer → Helper : int; // ContributionHelper → Seller : { // Choice
ok: Seller → Helper: string;end,
ko: end}
![Page 62: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/62.jpg)
Buyer → Seller : string; // Ask the priceSeller → Buyer : int; // Get the priceBuyer → Helper : int; // ContributionHelper → Seller : { // Choice
ok: Seller → Helper: string;end,
ko: end}
alice[Buyer], bob[Helper] start amazon[Seller] : a(k)
● Let a be a public URL (e.g., www.amazon.com) with the protocol above.
CreatedProcesses
Publicname
CreatedSession
ActiveProcess
![Page 63: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/63.jpg)
Buyer → Seller : string; // Ask the priceSeller → Buyer : int; // Get the priceBuyer → Helper : int; // ContributionHelper → Seller : { // Choice
ok: Seller → Helper: string;end,
ko: end}
alice[Buyer], bob[Helper] start amazon[Seller] : a(k) ;alice.”rabbits” → amazon.book : k
Receiver SessionSender
![Page 64: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/64.jpg)
Buyer → Seller : string; // Ask the priceSeller → Buyer : int; // Get the priceBuyer → Helper : int; // ContributionHelper → Seller : { // Choice
ok: Seller → Helper: string;end,
ko: end}
alice[Buyer], bob[Helper] start amazon[Seller] : a(k) ;alice.”rabbits” → amazon.book : k ;amazon.price(book) → alice.price : k
Receiver SessionSender
![Page 65: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/65.jpg)
Buyer → Seller : string; // Ask the priceSeller → Buyer : int; // Get the priceBuyer → Helper : int; // ContributionHelper → Seller : { // Choice
ok: Seller → Helper: string;end,
ko: end}
alice[Buyer], bob[Helper] start amazon[Seller] : a(k) ;alice.”rabbits” → amazon.book : k ;amazon.price(book) → alice.price : k ;alice.(price/2) → bob.contrib : k
Receiver SessionSender
![Page 66: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/66.jpg)
Buyer → Seller : string; // Ask the priceSeller → Buyer : int; // Get the priceBuyer → Helper : int; // ContributionHelper → Seller : { // Choice
ok: Seller → Helper: string;end,
ko: end}
alice[Buyer], bob[Helper] start amazon[Seller] : a(k) ;alice.”rabbits” → amazon.book : k ;amazon.price(book) → alice.price : k ;alice.(price/2) → bob.contrib : k ;if (contrib < 100$)@bob
EvaluatorCondition
![Page 67: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/67.jpg)
Buyer → Seller : string; // Ask the priceSeller → Buyer : int; // Get the priceBuyer → Helper : int; // ContributionHelper → Seller : { // Choice
ok: Seller → Helper: string;end,
ko: end}
alice[Buyer], bob[Helper] start amazon[Seller] : a(k) ;alice.”rabbits” → amazon.book : k ;amazon.price(book) → alice.price : k ;alice.(price/2) → bob.contrib : k ;if (contrib < 100$)@bob
bob → amazon : k[ok]
Receiver SessionSender
![Page 68: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/68.jpg)
Buyer → Seller : string; // Ask the priceSeller → Buyer : int; // Get the priceBuyer → Helper : int; // ContributionHelper → Seller : { // Choice
ok: Seller → Helper: string;end,
ko: end}
alice[Buyer], bob[Helper] start amazon[Seller] : a(k) ;alice.”rabbits” → amazon.book : k ;amazon.price(book) → alice.price : k ;alice.(price/2) → bob.contrib : k ;if (contrib < 100$)@bob
bob → amazon : k[ok] ;amazon.text(book) → bob.text : k
Receiver SessionSender
![Page 69: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/69.jpg)
Buyer → Seller : string; // Ask the priceSeller → Buyer : int; // Get the priceBuyer → Helper : int; // ContributionHelper → Seller : { // Choice
ok: Seller → Helper: string;end,
ko: end}
alice[Buyer], bob[Helper] start amazon[Seller] : a(k) ;alice.”rabbits” → amazon.book : k ;amazon.price(book) → alice.price : k ;alice.(price/2) → bob.contrib : k ;if (contrib < 100$)@bob
bob → amazon : k[ok] ;amazon.text(book) → bob.text : k
else
![Page 70: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/70.jpg)
Buyer → Seller : string; // Ask the priceSeller → Buyer : int; // Get the priceBuyer → Helper : int; // ContributionHelper → Seller : { // Choice
ok: Seller → Helper: string;end,
ko: end}
alice[Buyer], bob[Helper] start amazon[Seller] : a(k) ;alice.”rabbits” → amazon.book : k ;amazon.price(book) → alice.price : k ;alice.(price/2) → bob.contrib : k ;if (contrib < 100$)@bob
bob → amazon : k[ok] ;amazon.text(book) → bob.text : k
elsebob → amazon : k[ko]
Receiver SessionSender
![Page 71: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/71.jpg)
● We provide a compiler to executable code in Jolie.
● The code is guaranteed to be deadlock-free by construction.
● Jolie allows us to reuse executables in different deployments (HTTP, etc.).
● Demo.
Compiler
compiler
![Page 72: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/72.jpg)
● We used Chor for evaluating our approach with representative use cases:
● authentication protocols (OpenID);
● E-Commerce;
● data streaming;
● service discovery.
● Industrial collaborators:
Evaluation
![Page 73: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/73.jpg)
Conclusions
![Page 74: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/74.jpg)
● A new language for a new paradigm.
● Guarantees deadlock-freedom: suitable for critical systems.
● Fast prototyping of systems.
● A lot of future work to do!
Conclusions
![Page 75: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/75.jpg)
● No support for external services yet (e.g., cannot invoke Google search).
● No support for round-trip programming.
Limitations
![Page 76: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/76.jpg)
Future Directions
![Page 77: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/77.jpg)
Future directions
● How far can we go? Need for more systematic studies.
Projections ofChoreographies
Deadlock-freesystems
![Page 78: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/78.jpg)
Future directions
● Exploiting the global view of choreographies in:
● Fault handling.
● Reversible computing.
● Security.
● Model checking.
![Page 79: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/79.jpg)
● More information at:
● Chor Website: http://www.chor-lang.org/
● Jolie Website: http://www.jolie-lang.org/
● My web page: http://www.fabriziomontesi.com/
Fabrizio → audience : Thank you!
![Page 80: Demo presentation chor](https://reader034.vdocuments.mx/reader034/viewer/2022050923/55c10b32bb61eb5a348b4601/html5/thumbnails/80.jpg)
Questions?
Choreographies Deadlock-freesystems