Idioms for Interaction: Functional Types, Process Types and Distributed Systems http://mrg.doc.ic.ac.uk/ Nobuko Yoshida Imperial College London 1
Outline ➤ Idioms for Interaction ➤ Multiparty Session Types ➤ Scribble and Applications to a Large-scale Cyberinfrastructure ➤ Recent Results on Multiparty Session Types 2
Programming languages are tools which offer frameworks of abstraction for such activities – promoting or limiting them • Imperative • Functional • Logical
UNSTRUCTURED: STRUCTURED:
Quicksort in pure lambda: Quicksort with combinators:
Quicksort in ML:
ENCODING
Current: Communication is Ubiquitous ➤ The way to organise software is increasingly based on communications (Cloud Computing, many cores, message-passing parallel computation, ...) ➤ Question ➣ How to formally abstract/specify/implement/control communications? ➣ How to apply mobile processes and their type theories to real distributed applications and programming languages? 3
Current: Communication is Ubiquitous ➤ The way to organise software is increasingly based on communications (Cloud Computing, many cores, message-passing parallel computation, ...) ➤ Question ⇒ Multiparty session type theory = ➣ How to formally abstract/specify/implement/control communications? ➣ How to apply mobile processes and their type theories to real distributed applications and programming languages? ⇒ large-scale cyberinfrastructure for e-Science = 4
Ocean Observatories Initiative ➤ A NSF project (400M$, 5 Years) to build a cyberinfrastructure for observing oceans around US and beyond. ➤ Real-time sensor data constantly coming from both off-shore and on-shore (e.g. buoys, submarines, under-water cameras, satellites), transmitted via high-speed networks. 7
Ocean Observatories Initiative 8
Challenges ➤ The need to specify, catalogue, program, implement and manage multiparty message passing protocols . ➤ Communication assurance ➣ Correct message ordering and synchronisation ➣ Deadlock-freedom, progress and liveness ➣ Dynamic message monitoring and recovery ➣ Logical constraints on message values ➤ Shared and used over a long-term period (e.g. 30 years in OOI). 9
Why Multiparty Session Types? ➤ Robin Milner (2002): Types are the leaven of computer programming; they make it digestible . ⇒ Can describe communication protocols as types = ⇒ Can be materialised as new communications = programming languages and tool chains . ➤ Scalable automatic verifications (deadlock-freedom, safety and liveness) without state-space explosion problems ( polynomial time complexity ). ➤ Extendable to logical verifications and flexible dynamic monitoring . 10
Dialogue between Industry and Academia Binary Session Types [PARL’94, ESOP’98] ⇓ Milner, Honda and Yoshida joined W3C WS-CDL (2002) ⇓ Formalisation of W3C WS-CDL [ESOP’07] ⇓ Scribble at Technology 11
Petri-Pi Working Group led by R. Milner and W.M.P van der Aalst started in 2003
Beginning: Petri-Pi From: Robin Milner Date: Wed, February 11, 2004 1:02 pm Steve Thanks for that. I believe the pi-calculus team ought to be able to do something with it -- you seem to be taking it in that direction already. Nobuko, Kohei: I thought we ought to try to model use-cases in pi-calculus, with copious explanations in natural language, aiming at seeing how various concepts like role, transaction, .. would be modelled in pi. I am hoping to try this one when I get time; you might like to try too, and see if we agree! Robin 12
Dr Gary Brown (Pi4 Tech) in 2007
Dialogue between Industry and Academia Binary Session Types [PARL’94, ESOP’98] ⇓ Milner, Honda and Yoshida joined W3C WS-CDL (2002) ⇓ Formalisation of W3C WS-CDL [ESOP’07] ⇓ Scribble at Technology ⇓ Multiparty Session Types [POPL’08] ⇓ 13
Dialogue between Industry and Academia Binary Session Types [PARL’94, ESOP’98] ⇓ Milner, Honda and Yoshida joined W3C WS-CDL (2002) ⇓ Formalisation of W3C WS-CDL [ESOP’07] ⇓ Scribble at Technology ⇓ Multiparty Session Types [POPL’08] ⇓ 14
Session Types Overview Properties Communication safety (no communication mismatch) Communication fidelity (the communication follow the protocol) Progress (no deadlock/stuck in a session)
������������ ���� � ������ ������������� ������� ������� � ���������� ������������� ��������� � ������� �� ���������������������� ����������� ���������� ������������ ������������ � ���������� ������������� ������������������ �������� ��������� ��������� � ������������������ ������������������ ������������� ����������� � ���� ������ ��������������� ���������������� �������� � ����������� �������� ������������������������������� ��� ��������������
�������������������������������������� � ����������� � ������������������ ������������������������ ���������� �������� � �������������� ����������� ����������������� � ������������������������ ���������������� � ��������������������� ���������
www.scribble.org
��������� �������� �����������
Buyer: A local projection
OOI agent negotiation 1/5 I https://confluence.oceanobservatories.org/display/syseng/ CIAD+COI+OV+Negotiate+Protocol 11 / 42
OOI agent negotiation 2/5 type <yml> "SAPDoc1" from "SAPDoc1.yml" as SAP; global protocol Negotiate(role Consumer as C, role Producer as P) { } 12 / 42
OOI agent negotiation 3/5 (choice) type <yml> "SAPDoc1" from "SAPDoc1.yml" as SAP; global protocol Negotiate(role Consumer as C, role Producer as P) { propose(SAP) from C to P; choice at P { accept() from P to C; confirm() from C to P; } or { reject() from P to C; } or { propose(SAP) from P to C; } } 13 / 42
OOI agent negotiation 4/5 type <yml> "SAPDoc1" from "SAPDoc1.yml" as SAP; global protocol Negotiate(role Consumer as C, role Producer as P) { propose(SAP) from C to P; choice at P { accept() from P to C; confirm() from C to P; } or { reject() from P to C; } or { propose(SAP) from P to C; choice at C { accept() from C to P; confirm() from P to C; } or { reject() from C to P; } or { propose(SAP) from C to P; } } } 14 / 42
OOI agent negotiation 5/5 (recursion) type <yml> "SAPDoc1" from "SAPDoc1.yml" as SAP; global protocol Negotiate(role Consumer as C, role Producer as P) { propose(SAP) from C to P; rec X { choice at P { accept() from P to C; confirm() from C to P; } or { reject() from P to C; } or { propose(SAP) from P to C; choice at C { accept() from C to P; confirm() from P to C; } or { reject() from C to P; } or { propose(SAP) from C to P; continue X; } } 15 / 42
Local protocol projection (Negotiation Consumer) // Projection for Consumer // Global propose(SAP) to P; propose(SAP) from C to P; rec START { rec START { choice at P { choice at P { accept() from P; accept() from P to C; confirm() to P; confirm() from C to P; } or { } or { reject() from P; reject() from P to C; } or { } or { propose(SAP) from P; propose(SAP) from P to C; choice at C { choice at C { accept() to P; accept() from C to P; confirm() from P; confirm() from P to C; } or { } or { reject() to P; reject() from C to P; } or { } or { propose(SAP) to P; propose(SAP) from C to P; continue START; continue START; } } } } } } 19 / 42
FSM generation (Negotiation Consumer) 20 / 42
Recommend
More recommend