Type Me If You Can

Be1c8a24b76f8b2b23f53eb22d401810?s=47 Imperial ACM
October 25, 2013

Type Me If You Can


Imperial ACM

October 25, 2013


  1. Type Me If You Can Rumyana Neykova Distributed Systems Types

    Session Types
  2. type: me Rumyana_Neykova = {country: ‘Bulgaria’, bachelor: ‘Computer Science’, MSc:

    ‘Software Engineering’ } me.loves = [facts, racket_sports, travel]  If fact.useless and fact.funny: me.loves[facts] = fact  if you.loves.contains(‘squash’): you.contact(me)  [me.travel() for day in free_days]
  3. Me ∈ Mobility Research Group Ray Nick Nobuko Laura Luca

    Rumi Julien
  4. Me ∈ Imperial ACM Student Chapter  http://acm.doc.ic.ac.uk/

  5. Let’s start Multiparty Session Types:

  6. Observation 1: Types  One of the computing most successful

    concepts  Codify the structure of the data  Serve as a fundamental unit of compositionality  Allow easy error prevention  Appears from the oldest to the newest programming languages Robin Milner: Types are the yeast of computer programming: they make it digestible !!!
  7. Observation 2: But distributed systems …

  8. Then…  Can we have types that describe the communication,

    not the computation ? Distributed Systems Types Session Types  How to formally abstract/specify and practically implement/control communications?
  9. Building blocks  Primitives – to build the types 

    send, receive (well , there are few more, but it boils down to these two )  Context – to be checked by the type system  protocols – describe the communication between processes
  10. Defining the type  Separate the communication into sessions 

    Each process has a type in a session, defined by the interactions on the session channel
  11. A Protocol Alice Seller title quote Address Date ok quit

     Protocol: Buyer-Seller  Description: Alice buying a book
  12. Are we compatible?

  13. Are we compatible?

  14. Wait a minute! What if it is more than 2?

    Alice Seller Bob Carol quote Address Date quote ok ok Delegate T
  15. How does it work?  Step 1: Write a Global

    Type  Step 2: Write Local Programs  Step 3: Project and Type Check Locally
  16. Session Types in a Nutshell “…Session Types structure a series

    of interactions in a simple and concise syntax and ensure type safe communication.”
  17. What is type safe communication? • Communication follow the described

    protocol • No communication mismatch Communication Safety Session Fidelity • No deadlock/ stuck in a session Progress
  18. www.scribble.org

  19. Scribble: www.scribble.org

  20. How does it work?  Step 1: Write a Global

    Type  Step 2: Write Local Programs  Step 3: Project and Type Check Locally
  21. Let’s catch some errors:

  22. Session types: Implications Programming Language Runtime Architecture  Augmented with

    communication primitives (send, receive, choice…)  Messages are augmented with communication header (sender, receiver, label, conditions…)  Capture the global communication, centering on interactions
  23. Applications…food for though Type are used for early error detection

    Types are used to optimise the memory layout Types are used as a guidance when we design programs
  24. There is so much garbage here  Session types prevent

    cluttering the network with nonsense messages.
  25. Hey, same direction ..will give you a ride. Session types

    can be used to optimise the communication flow, grouping messages together
  26. Lost in Translation Session types can be used for Testable

    architectures - where the specification match the implementation
  27. Ok, let’s summarize  Organize the whole communication into sessions(communication

    protocols)  The result is that every distributed object can be given a type inside a session  A checker (a type system) can judge whether 2 or more objects are compatible to communicate
  28. Ok … why we need types again?  Having a

    context allows to control the communication  Having granularity allows to put constraints on the right place  Early error detection is much cheaper  More documented code  Nice abstraction means easy programming – you program with send and receive (no threads, sockets, channels)
  29. What my PhD is about When the endpoints are not

    typed… the communication assurance is lost 
  30. What my PhD is about? Transport Monitor Monitor Monitor PAlice

    PCarol PBob Attach(Embed) monitor to each application (CC). Monitors check that every incoming and outgoing message is correct w.r.t. the specifications via message header. ... Sender: you Receiver: me Label: Hello …
  31. Case Study: OOI Usage: Integrate real-time data acquisition, processing and

    data storage for ocean research,… OOI aims: to deploy an infrastructure (global network) to expand the scientists’ ability to remotely study the ocean
  32. Checking the ocean Challenge: It is all RPC , how

    and why to transform it into conversation Collaboration: build conversation layer on top of OOI network to guarantee global safety
  33. To summarize

  34. To summarize

  35. To summarize

  36. Dedication Kohei Honda The Father of Session Types

  37. It is your turn …