demo presentation chor

80
The Chor programming language Fabrizio Montesi <[email protected]>

Upload: imds2014

Post on 05-Aug-2015

64 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Demo presentation chor

The Chor programming language

Fabrizio Montesi<[email protected]>

Page 2: Demo presentation chor

Background and Motivations

Page 3: Demo presentation chor

● Distributed system: a network of endpoints that communicate by exchanging messages.

● Widespread! Let's see some examples...

Distributed Systems

Page 4: Demo presentation chor

● The Internet is a distributed system:

The Internet

Page 5: Demo presentation chor

= Endpoint

● The Internet is a distributed system:

The Internet

Page 6: Demo presentation chor

OS

● The OS and apps in your computer (or phone):

Your Computer

Page 7: Demo presentation chor

● Even applications can be distributed systems. Google Chrome:

Tab Manager

Your browser

Page 8: Demo presentation chor

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

● 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

● 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

● Endpoint programming is error-prone.

Deadlocks

Page 12: Demo presentation chor

● 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

● 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

● 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

● 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

● 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

● 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

● 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

● In general, we would like systems to be safe.

● Safe = no bugs given by wrong sending/receiving actions.

Safety

Page 20: Demo presentation chor

● Human error.

How does it happen?

Page 21: Demo presentation chor

● Human error.

● More quality control?

How does it happen?

Page 22: Demo presentation chor

recv price from Amazonsend “rabbits” to Amazon

Alice Amazonrecv book from Alicesend price(book) to Alice

Checking for bugs

Page 23: Demo presentation chor

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

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

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

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

● 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

Problem

Developing safe distributed systems by programmingendpoints separately is error-prone.

Page 29: Demo presentation chor

Choreographic Programming: the idea

Page 30: Demo presentation chor

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

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

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

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

Choreographic Programming

● [Mendling and Hafner, 05] [Qiu et al., 07][Carbone et al., 07] [Lanese et al., 08] ...

Page 35: Demo presentation chor

Choreographic Programming

● Write a choreography.

Choreography

Page 36: Demo presentation chor

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

Example of projection

alice.”rabbits” → amazon.book ;amazon.price(book) → alice.price

Page 38: Demo presentation chor

Example of projection

alice.”rabbits” → amazon.book ;amazon.price(book) → alice.price

alice amazon

Compiler

Page 39: Demo presentation chor

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

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

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

● 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

● 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

● 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

● 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

● Lots of promising formal models.

● We need tools to evaluate the paradigm.

Towards a new paradigm

Page 47: Demo presentation chor

Methodology

Page 48: Demo presentation chor

● 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

Protocols(specifications)

Choreography(implementation)

C

Verification

Endpoint code

P1

Endpoint code

Pn...

Compiler

Development methodology

Page 50: Demo presentation chor

● 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

● Alice and Bob buy together a book on Amazon.

An example

Page 52: Demo presentation chor

Protocol

Choreography

An example

Page 53: Demo presentation chor

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

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

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

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

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

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

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

Protocol

Choreography

Page 61: Demo presentation chor

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

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

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

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

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

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

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

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

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

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

● 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

● 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

Conclusions

Page 74: Demo presentation chor

● 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

● No support for external services yet (e.g., cannot invoke Google search).

● No support for round-trip programming.

Limitations

Page 76: Demo presentation chor

Future Directions

Page 77: Demo presentation chor

Future directions

● How far can we go? Need for more systematic studies.

Projections ofChoreographies

Deadlock-freesystems

Page 78: Demo presentation chor

Future directions

● Exploiting the global view of choreographies in:

● Fault handling.

● Reversible computing.

● Security.

● Model checking.

Page 79: Demo presentation chor

● 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

Questions?

Choreographies Deadlock-freesystems