Scribbling Interactions with a Formal Foundation by Kohei Honda, Aybek Mukhamedov, Gary Brown, Tzu-Chun Chen, and Nobuko Yoshida Slides by Jes Hansen - University of Southern Denmark
Scribbling Interactions with a Formal Foundation
by Kohei Honda, Aybek Mukhamedov, Gary Brown, Tzu-Chun Chen, and Nobuko Yoshida
Slides by Jes Hansen - University of Southern Denmark
Overview of Presentation• Motivations & Background
• Protocols
• The challenge
• Overview of Scribble
• Scribble: The language
• Example
• Types
Motivations and Background
• We have a good understanding of sequential programming - not distributed
• Distributed systems are becoming frequent and large
• examples: Serverparks, multiprocessor chips, webservers, distributed big data processing
Protocols• Protocol: Agreement of how to communicate
among multiple processes
• Scribble and structured communication: Protocols
• Use every day - internet
• Multicore chip
• Heart of distributed communication
Protocols in the financial world (FP)
• Controlled by: the Technical Committee for Global Financial Services in ISO
• Message format not enough
• Flow of asynchronous messages - need choreography
The description of the message choreography through the current technology has severe limitations:
1. It is imprecise: The descriptions of protocols are unclear, ambiguous and misleading, and legally unusable.
2. It is incomplete: It is impossible to describe the structure and constraints of FPs in their entirety up to a suitable abstraction level.
3. It is informal: The description cannot be used for formal reasoning about protocols; for checking their internal consistency; for verifying, either by hand or by machine, the conformance of endpoint programs against a given protocol; for code generation; for testing; and for runtime control.
The challenge
• Distributed systems are here to stay - Deal with it
• There is no core descriptive framework for large distributed systems
• Create such a System
The Answer: Scribble
• Based on π-calculus
• Simple language for describing communication, using protocols
• Session types -> interaction of overlapping protocols
Overview of Scribble
API: Should use; Java, python, C++…..
Protocol type checker: Inspects the application code - does communication follow protocol
Runtime monitor: Reads in a Scribble protocol specification and inspects runtime communication behaviour of an application.
Transport characteristics• We assume the following:
• Asynchrony: send actions are non-blocking.
• Message order preservation: the order of messages from the same participant to another participant in a single conversation is preserved.
• Reliability: a message is never lost or tampered with during transmission.
Hello World!
Main constructs• At most one preamble - one or more imports
• A single protocol definition: keyword protocol, the name, protocol body {}.
• Protocol body: role declarations and interaction descripters
• Roles: placeholders for endpoints
The language - Roles
• role role1, ..., roleN; is equivalent to
• role role1; ...role roleN;
Interaction Descriptions• msgType from role1 to role2;
• Message type msgType is imported
• Message type can be base or composite
• Base: int, bool or user defined
• Composite: Sequence of base types
Sequencing• I1; I2; ...; In
• Interaction sentence, where if the same role name appears in both Ii and I(i + k), then communication order is given
• If none of the role names overlap between I1 and In, then no order is specified
Unordered (Parallel)
• I1 & I2 & ... In
• represents interleaved interactions that may be observed in any order. We write: msgType from role1 to role2,.., roleK; ormsgType from role1 to role2 & .. & msgType from role1 to roleK;
Directed Choice
Interaction flow branching, role1 makes a choice msgTypej to continue interaction following scenario
in Ij
Example
Recursion• rec BlockName { I }
• when #BlockName is encountered - the whole block is executed
Nested Protocols
• run Protocol(param1,.., paramk, roleInChild1=roleInParent1,.., roleInChildn= roleInParentn);
• Method for running a protocol within a protocol
Example
• Web services: Travel Agent.
Formal Foundations of Scribble - Types
• Based on π-calculus and its type theory, session types
• Session types set rules of conversation - Global type: describes the whole conversation
• Like protocol in scribble
Safety Assurance by Session Types.
• Session types provide a static type check
• “well-typed processes never exchange wrong values.”
• Each session has linearity: “an output is never shared by more than one inputs, and vice versa.”
• “interactions inside a session among well-typed processes under a global type, never violate the scenarios given in that type.”
Thanks
• Q&A