Top Banner
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
28

Scribbling Interactions with a Formal Foundation

Aug 05, 2015

Download

Science

IMDS2014
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Scribbling Interactions with a Formal Foundation

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

Page 2: Scribbling Interactions with a Formal Foundation

Overview of Presentation• Motivations & Background

• Protocols

• The challenge

• Overview of Scribble

• Scribble: The language

• Example

• Types

Page 3: Scribbling Interactions with a Formal Foundation

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

Page 4: Scribbling Interactions with a Formal Foundation

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

Page 5: Scribbling Interactions with a Formal Foundation

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

Page 6: Scribbling Interactions with a Formal Foundation

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.

Page 7: Scribbling Interactions with a Formal Foundation

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

Page 8: Scribbling Interactions with a Formal Foundation

The Answer: Scribble

• Based on π-calculus

• Simple language for describing communication, using protocols

• Session types -> interaction of overlapping protocols

Page 9: Scribbling Interactions with a Formal Foundation

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.

Page 10: Scribbling Interactions with a Formal Foundation

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.

Page 11: Scribbling Interactions with a Formal Foundation

Hello World!

Page 12: Scribbling Interactions with a Formal Foundation

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

Page 13: Scribbling Interactions with a Formal Foundation

The language - Roles

• role role1, ..., roleN; is equivalent to

• role role1; ...role roleN;

Page 14: Scribbling Interactions with a Formal Foundation

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

Page 15: Scribbling Interactions with a Formal Foundation

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

Page 16: Scribbling Interactions with a Formal Foundation

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;

Page 17: Scribbling Interactions with a Formal Foundation

Directed Choice

Interaction flow branching, role1 makes a choice msgTypej to continue interaction following scenario

in Ij

Page 18: Scribbling Interactions with a Formal Foundation

Example

Page 19: Scribbling Interactions with a Formal Foundation

Recursion• rec BlockName { I }

• when #BlockName is encountered - the whole block is executed

Page 20: Scribbling Interactions with a Formal Foundation

Nested Protocols

• run Protocol(param1,.., paramk, roleInChild1=roleInParent1,.., roleInChildn= roleInParentn);

• Method for running a protocol within a protocol

Page 21: Scribbling Interactions with a Formal Foundation

Example

• Web services: Travel Agent.

Page 22: Scribbling Interactions with a Formal Foundation
Page 23: Scribbling Interactions with a Formal Foundation
Page 24: Scribbling Interactions with a Formal Foundation
Page 25: Scribbling Interactions with a Formal Foundation

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

Page 26: Scribbling Interactions with a Formal Foundation
Page 27: Scribbling Interactions with a Formal Foundation

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.”

Page 28: Scribbling Interactions with a Formal Foundation

Thanks

• Q&A